changeset 33457:61714c282106

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).
author Boris Feld <boris.feld@octobus.net>
date Wed, 12 Jul 2017 23:15:09 +0200
parents ae052d04b89e
children cf694e6422f0
files mercurial/phases.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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