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

login
register
mail settings
Submitter Sean Farley
Date Sept. 5, 2013, 8:07 p.m.
Message ID <77722ab0c3fc0815224a.1378411649@laptop.local>
Download mbox | patch
Permalink /patch/2372/
State Accepted
Commit 594f4d2b0ce90d09cc7e73564619476f5b5280b4
Headers show

Comments

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

Patch

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 []