changeset 24519:de3acfabaddc

phases: move pure phase computation in a function
author Laurent Charignon <lcharignon@fb.com>
date Mon, 30 Mar 2015 12:48:15 -0700
parents dd5e56f08d13
children 34e8bfc21f94
files mercurial/phases.py
diffstat 1 files changed, 14 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/phases.py	Tue Mar 24 14:24:55 2015 -0700
+++ b/mercurial/phases.py	Mon Mar 30 12:48:15 2015 -0700
@@ -179,22 +179,25 @@
             nativeroots.append(map(repo.changelog.rev, self.phaseroots[phase]))
         return repo.changelog.computephases(nativeroots)
 
+    def computephaserevspure(self, repo):
+        repo = repo.unfiltered()
+        revs = [public] * len(repo.changelog)
+        self._phaserevs = revs
+        self._populatephaseroots(repo)
+        for phase in trackedphases:
+            roots = map(repo.changelog.rev, self.phaseroots[phase])
+            if roots:
+                for rev in roots:
+                    revs[rev] = phase
+                for rev in repo.changelog.descendants(roots):
+                    revs[rev] = phase
+
     def getphaserevs(self, repo):
         if self._phaserevs is None:
             try:
                 self._phaserevs = self.getphaserevsnative(repo)
             except AttributeError:
-                repo = repo.unfiltered()
-                revs = [public] * len(repo.changelog)
-                self._phaserevs = revs
-                self._populatephaseroots(repo)
-                for phase in trackedphases:
-                    roots = map(repo.changelog.rev, self.phaseroots[phase])
-                    if roots:
-                        for rev in roots:
-                            revs[rev] = phase
-                        for rev in repo.changelog.descendants(roots):
-                            revs[rev] = phase
+                self.computephaserevspure(repo)
         return self._phaserevs
 
     def invalidate(self):