# HG changeset patch
# User Boris Feld <boris.f...@octobus.net>
# Date 1499728656 -7200
#      Tue Jul 11 01:17:36 2017 +0200
# Node ID c60ee8233517c9e84d5907ea2822f16667d31ca8
# Parent  d331c624636b7c88f54170c7d600e6d4480aa23b
# EXP-Topic tr.changes.phases
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.

diff -r d331c624636b -r c60ee8233517 mercurial/changegroup.py
--- 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:
 
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to