[PATCH] phases: implement ``phase()`` and ``hidden()`` method for workingctx

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Tue Dec 20 05:37:27 CST 2011


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1324380288 -3600
# Node ID ffcda6c337f47e06a4b688613cb810366a7635c6
# Parent  9d62a0e54cdb861635fe29db437a8a5a5e8e0180
phases: implement ``phase()`` and ``hidden()`` method for workingctx

default changectx crash while trying to index a list with None.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -801,10 +801,19 @@ class workingctx(changectx):
         b = []
         for p in self.parents():
             b.extend(p.bookmarks())
         return b
 
+    def phase(self):
+        phase = 1 # default phase to draft
+        for p in self.parents():
+            phase = max(phase, p.phase())
+        return phase
+
+    def hidden(self):
+        return False
+
     def children(self):
         return []
 
     def flags(self, path):
         if '_manifest' in self.__dict__:


More information about the Mercurial-devel mailing list