phases: implement ``phase()`` and ``hidden()`` method for workingctx
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Wed, 21 Dec 2011 23:56:15 +0100
changeset 15707 dc3eefe0c80e
parent 15706 ebaefd8c6028
child 15708 309e49491253
phases: implement ``phase()`` and ``hidden()`` method for workingctx Working ctx don't have revision number and need a dedicated implementation.
mercurial/context.py
--- a/mercurial/context.py	Tue Dec 20 01:31:25 2011 +0100
+++ b/mercurial/context.py	Wed Dec 21 23:56:15 2011 +0100
@@ -805,6 +805,15 @@
             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 []