mercurial/changegroup.py
changeset 33456 ae052d04b89e
parent 33406 168ba5c4dfcb
child 33461 bb72031f0ea8
--- 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: