mercurial/localrepo.py
changeset 15420 e80d0d3198f0
parent 15418 cf729af26963
child 15454 5a7dde5adec8
--- a/mercurial/localrepo.py	Sun Nov 06 11:57:24 2011 -0600
+++ b/mercurial/localrepo.py	Fri Nov 04 00:20:20 2011 +0100
@@ -174,6 +174,18 @@
     def _phaseroots(self):
         return phases.readroots(self)
 
+    @propertycache
+    def _phaserev(self):
+        cache = [0] * len(self)
+        for phase in phases.trackedphases:
+            roots = map(self.changelog.rev, self._phaseroots[phase])
+            if roots:
+                for rev in roots:
+                    cache[rev] = phase
+                for rev in self.changelog.descendants(*roots):
+                    cache[rev] = phase
+        return cache
+
     @filecache('00changelog.i', True)
     def changelog(self):
         c = changelog.changelog(self.sopener)