diff mercurial/phases.py @ 25190:22438cfd11b5

phases: add set per phase in C phase computation To speed up the computation of draft(), secret(), divergent(), obsolete() and unstable() we need to have a fast way of getting the list of revisions that are in draft(), secret() or the union of both: not public(). This patch extends the work on phase computation in C and make the phase computation code also return a list of set for each non public phase. Using these sets we can quickly obtain all the revisions of a given phase. We do not return a set for the public phase as we expect it to be roughly the size of the repo. Also, it can be computed easily by substracting the entries in the non public phases from all the revs in the repo.
author Laurent Charignon <lcharignon@fb.com>
date Wed, 01 Apr 2015 11:17:17 -0700
parents 2a73829ebe17
children 262e6ad93885
line wrap: on
line diff
--- a/mercurial/phases.py	Fri May 08 12:30:51 2015 -0700
+++ b/mercurial/phases.py	Wed Apr 01 11:17:17 2015 -0700
@@ -155,6 +155,7 @@
             # Cheap trick to allow shallow-copy without copy module
             self.phaseroots, self.dirty = _readroots(repo, phasedefaults)
             self._phaserevs = None
+            self._phasesets = None
             self.filterunknown(repo)
             self.opener = repo.svfs
 
@@ -177,7 +178,7 @@
         nativeroots = []
         for phase in trackedphases:
             nativeroots.append(map(repo.changelog.rev, self.phaseroots[phase]))
-        return repo.changelog.computephases(nativeroots)
+        return repo.changelog.computephasesmapsets(nativeroots)
 
     def _computephaserevspure(self, repo):
         repo = repo.unfiltered()
@@ -199,7 +200,8 @@
                                       'nativephaseskillswitch'):
                     self._computephaserevspure(repo)
                 else:
-                    self._phaserevs = self._getphaserevsnative(repo)
+                    res = self._getphaserevsnative(repo)
+                    self._phaserevs, self._phasesets = res
             except AttributeError:
                 self._computephaserevspure(repo)
         return self._phaserevs