# HG changeset patch # User Boris Feld <boris.f...@octobus.net> # Date 1499883060 -7200 # Wed Jul 12 20:11:00 2017 +0200 # Node ID 14007d8eba4dd21240bb243e45394fa0dc70545b # Parent d90b8e445f0f48ebcac362fb1df6f5498f814f90 # EXP-Topic tr.changes.phases phases: track phase changes from 'retractboundary'
We adds new computation to find and record the revision affected by the boundary retraction. This add more complication to the function but this seems fine since it is only used in a couple of rare and explicit cases (`hg phase --force` and `hg qimport`). Having strong tracking of phase changes is worth the effort. diff -r d90b8e445f0f -r 14007d8eba4d mercurial/phases.py --- a/mercurial/phases.py Wed Jul 12 23:15:09 2017 +0200 +++ b/mercurial/phases.py Wed Jul 12 20:11:00 2017 +0200 @@ -348,7 +348,30 @@ repo.invalidatevolatilesets() def retractboundary(self, repo, tr, targetphase, nodes): - self._retractboundary(repo, tr, targetphase, nodes) + oldroots = self.phaseroots[:targetphase + 1] + if tr is None: + phasetracking = None + else: + phasetracking = tr.changes.get('phases') + repo = repo.unfiltered() + if (self._retractboundary(repo, tr, targetphase, nodes) + and phasetracking is not None): + + # find the affected revisions + new = self.phaseroots[targetphase] + old = oldroots[targetphase] + affected = set(repo.revs('(%ln::) - (%ln::)', new, old)) + + # find the phase of the affected revision + for phase in xrange(targetphase, -1, -1): + if phase: + roots = oldroots[phase] + revs = set(repo.revs('%ln::%ld', roots, affected)) + affected -= revs + else: # public phase + revs = affected + for r in revs: + _trackphasechange(phasetracking, r, phase, targetphase) repo.invalidatevolatilesets() def _retractboundary(self, repo, tr, targetphase, nodes): _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel