[PATCH 3 of 6 phases] phases: add a cache allowing to know in which phase a changeset is
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Fri Nov 4 09:02:31 UTC 2011
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1320362420 -3600
# Node ID 397adaea4f4bece4a79ca63d9f814b939f222adb
# Parent 9d9364532b0d84bbe24c619d0a184593a5dfa652
phases: add a cache allowing to know in which phase a changeset is
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -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)
More information about the Mercurial-devel
mailing list