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

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Dec 21 16:56:33 CST 2011


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1324508175 -3600
# Node ID e4439d02e1853b41e7362ce1289ebc5484b42e82
# Parent  1facaad963a8a2d0580e0f6d4dffd137b8b954d3
phases: implement ``phase()`` and ``hidden()`` method for workingctx

Working ctx don't have revision number and need a dedicated implementation.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -803,6 +803,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 []
 


More information about the Mercurial-devel mailing list