[PATCH 2 of 6 phases] phases: fix advanceboundary behavior when targetphase !=0

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Mon Dec 19 04:46:48 CST 2011


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1324290579 -3600
# Node ID 56a49ab7aa0310f126f6b8eea2c4d1dbc28bc7ab
# Parent  c320bc83c8c47c49414d09d1c1465aa0c9122511
phases: fix advanceboundary behavior when targetphase !=0

Changeset was properly removed from upper phase but was not explicitly added to
target phase. If advanced changesets had not pwasnt in target phase they was
considered public (0-phase).

diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -151,10 +151,11 @@ def advanceboundary(repo, targetphase, n
 
     This function move boundary *forward* this means that all nodes are set
     in the target phase or kept in a *lower* phase.
 
     Simplify boundary to contains phase roots only."""
+    delroots = [] # set of root deleted by this path
     for phase in xrange(targetphase + 1, len(allphases)):
         # filter nodes that are not in a compatible phase already
         # XXX rev phase cache might have been invalidated by a previous loop
         # XXX we need to be smarter here
         nodes = [n for n in nodes if repo[n].phase() >= phase]
@@ -168,10 +169,16 @@ def advanceboundary(repo, targetphase, n
         if olds != roots:
             # invalidate cache (we probably could be smarter here
             if '_phaserev' in vars(repo):
                 del repo._phaserev
             repo._dirtyphases = True
+            # some roots may need to be declared for lower phases
+            delroots.extend(olds - roots)
+        # declare deleted root in the target phase
+        if targetphase != 0:
+            retractboundary(repo, targetphase, delroots)
+
 
 def retractboundary(repo, targetphase, nodes):
     """Set nodes back to a phase changing other nodes phases if necessary.
 
     This function move boundary *backward* this means that all nodes are set


More information about the Mercurial-devel mailing list