phases: detect when boundaries has been actually retracted
It is useful to detect noop and avoid expensive operations in this case.
We return the information to inform the caller of a possible update. Top level
function might need to react to the phase update (eg: invalidating some
caches, tracking phase change).
--- a/mercurial/phases.py Tue Jul 11 01:17:36 2017 +0200
+++ b/mercurial/phases.py Wed Jul 12 23:15:09 2017 +0200
@@ -357,6 +357,7 @@
repo = repo.unfiltered()
currentroots = self.phaseroots[targetphase]
+ finalroots = oldroots = set(currentroots)
newroots = [n for n in nodes
if self.phase(repo, repo[n].rev()) < targetphase]
if newroots:
@@ -376,8 +377,10 @@
finalroots = set(n for n in currentroots if repo[n].rev() <
minnewroot)
finalroots.update(ctx.node() for ctx in updatedroots)
-
+ if finalroots != oldroots:
self._updateroots(targetphase, finalroots, tr)
+ return True
+ return False
def filterunknown(self, repo):
"""remove unknown nodes from the phase boundary