changeset 15453:cff509500a24

phases: improve context.phase() * force recompute of outdated cache * handle nullrev case
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Mon, 07 Nov 2011 18:37:58 +0100
parents de7e2fba4326
children 5a7dde5adec8
files mercurial/context.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Mon Nov 07 03:25:10 2011 +0100
+++ b/mercurial/context.py	Mon Nov 07 18:37:58 2011 +0100
@@ -118,6 +118,11 @@
     def bookmarks(self):
         return self._repo.nodebookmarks(self._node)
     def phase(self):
+        if self._rev == -1:
+            return 0
+        if self._rev >= len(self._repo._phaserev):
+            # outdated cache
+            del self._repo._phaserev
         return self._repo._phaserev[self._rev]
     def hidden(self):
         return self._rev in self._repo.changelog.hiddenrevs