changeset 33456:ae052d04b89e

phases: rework phase movement code in 'cg.apply' to use 'registernew' We rework the code to call 'registernew' before any other phase advancement. This make 'changegroup.apply' register correct phase movement for the added and bundled nodes.
author Boris Feld <boris.feld@octobus.net>
date Tue, 11 Jul 2017 01:17:36 +0200
parents b1bc8cf3fea8
children 61714c282106
files mercurial/changegroup.py
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changegroup.py	Tue Jul 11 00:59:23 2017 +0200
+++ b/mercurial/changegroup.py	Tue Jul 11 01:17:36 2017 +0200
@@ -356,6 +356,7 @@
                 repo.hook('pretxnchangegroup', throw=True, **hookargs)
 
             added = [cl.node(r) for r in xrange(clstart, clend)]
+            phaseall = None
             if srctype in ('push', 'serve'):
                 # Old servers can not push the boundary themselves.
                 # New servers won't push the boundary if changeset already
@@ -364,16 +365,19 @@
                 # We should not use added here but the list of all change in
                 # the bundle
                 if repo.publishing():
-                    phases.advanceboundary(repo, tr, phases.public, cgnodes)
+                    targetphase = phaseall = phases.public
                 else:
+                    # closer target phase computation
+
                     # Those changesets have been pushed from the
                     # outside, their phases are going to be pushed
                     # alongside. Therefor `targetphase` is
                     # ignored.
-                    phases.advanceboundary(repo, tr, phases.draft, cgnodes)
-                    phases.retractboundary(repo, tr, phases.draft, added)
-            else:
-                phases.retractboundary(repo, tr, targetphase, added)
+                    targetphase = phaseall = phases.draft
+            if added:
+                phases.registernew(repo, tr, targetphase, added)
+            if phaseall is not None:
+                phases.advanceboundary(repo, tr, phaseall, cgnodes)
 
             if changesets > 0: