[PATCH 35 of 48 RFC] commitablectx: move phase from workingctx

Sean Farley sean.michael.farley at gmail.com
Thu Sep 5 15:07:29 CDT 2013


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1376515499 18000
#      Wed Aug 14 16:24:59 2013 -0500
# Node ID 77722ab0c3fc0815224a618fdeb0f6522a6de5ca
# Parent  c1985b5d707dcef3204119ff14de74a85002e2ba
commitablectx: move phase from workingctx

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1004,10 +1004,16 @@
         b = []
         for p in self.parents():
             b.extend(p.bookmarks())
         return b
 
+    def phase(self):
+        phase = phases.draft # default phase to draft
+        for p in self.parents():
+            phase = max(phase, p.phase())
+        return phase
+
 class workingctx(commitablectx):
     """A workingctx object makes access to data related to
     the current working directory convenient.
     date - any valid date string or (unixtime, offset), or None.
     user - username string, or None.
@@ -1030,16 +1036,10 @@
         p = self._repo.dirstate.parents()
         if p[1] == nullid:
             p = p[:-1]
         return [changectx(self._repo, x) for x in p]
 
-    def phase(self):
-        phase = phases.draft # 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