# HG changeset patch # User Boris Feld # Date 2017-07-10 20:18:41 # Node ID d017f1d3737850c37125c2843ebc0c96cd0e1d8b # Parent 5747967e257c61d823356a7edd01c3b1dd063fc5 phases: extract the intermediate set of affected revs When advancing phases, we compute the new roots for the phases above. During this process, we need to compute all the revisions that change phases (to the new target phases). Extract these revisions into a separate variable. This will be useful to record the phase changes in the transaction. diff --git a/mercurial/phases.py b/mercurial/phases.py --- a/mercurial/phases.py +++ b/mercurial/phases.py @@ -283,6 +283,10 @@ class phasecache(object): tr.hookargs['phases_moved'] = '1' def advanceboundary(self, repo, tr, targetphase, nodes): + """Set all 'nodes' to phase 'targetphase' + + Nodes with a phase lower than 'targetphase' are not affected. + """ # Be careful to preserve shallow-copied values: do not update # phaseroots values, replace them. @@ -294,9 +298,12 @@ class phasecache(object): if self.phase(repo, repo[n].rev()) >= phase] if not nodes: break # no roots to move anymore + olds = self.phaseroots[phase] + affected = repo.revs('%ln::%ln', olds, nodes) + roots = set(ctx.node() for ctx in repo.set( - 'roots((%ln::) - (%ln::%ln))', olds, olds, nodes)) + 'roots((%ln::) - %ld)', olds, affected)) if olds != roots: self._updateroots(phase, roots, tr) # some roots may need to be declared for lower phases