mercurial/phases.py
changeset 24444 27e3ba73fbb1
parent 23878 37a92908a382
child 24519 de3acfabaddc
--- a/mercurial/phases.py	Tue Mar 24 11:00:09 2015 -0700
+++ b/mercurial/phases.py	Fri Mar 20 11:14:27 2015 -0700
@@ -172,19 +172,29 @@
         for a in 'phaseroots dirty opener _phaserevs'.split():
             setattr(self, a, getattr(phcache, a))
 
+    def getphaserevsnative(self, repo):
+        repo = repo.unfiltered()
+        nativeroots = []
+        for phase in trackedphases:
+            nativeroots.append(map(repo.changelog.rev, self.phaseroots[phase]))
+        return repo.changelog.computephases(nativeroots)
+
     def getphaserevs(self, repo):
         if self._phaserevs is None:
-            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
+            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
         return self._phaserevs
 
     def invalidate(self):