Patchwork [38,of,48,RFC] commitablectx: move flags from workingctx

login
register
mail settings
Submitter Sean Farley
Date Sept. 5, 2013, 8:07 p.m.
Message ID <71c828371ffd75b706a0.1378411652@laptop.local>
Download mbox | patch
Permalink /patch/2376/
State Accepted
Commit 6c52adcaba0ed14d510c9d44f255ea5daf07fa7a
Headers show

Comments

Sean Farley - Sept. 5, 2013, 8:07 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1376515543 18000
#      Wed Aug 14 16:25:43 2013 -0500
# Node ID 71c828371ffd75b706a037f860ed82ae5d67d1c0
# Parent  9b3ddba67aec58a5f2d27af04015114de43b7878
commitablectx: move flags from workingctx

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1016,10 +1016,22 @@ 
         return False
 
     def children(self):
         return []
 
+    def flags(self, path):
+        if '_manifest' in self.__dict__:
+            try:
+                return self._manifest.flags(path)
+            except KeyError:
+                return ''
+
+        try:
+            return self._flagfunc(path)
+        except OSError:
+            return ''
+
 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.
@@ -1042,22 +1054,10 @@ 
         p = self._repo.dirstate.parents()
         if p[1] == nullid:
             p = p[:-1]
         return [changectx(self._repo, x) for x in p]
 
-    def flags(self, path):
-        if '_manifest' in self.__dict__:
-            try:
-                return self._manifest.flags(path)
-            except KeyError:
-                return ''
-
-        try:
-            return self._flagfunc(path)
-        except OSError:
-            return ''
-
     def filectx(self, path, filelog=None):
         """get a file context from the working directory"""
         return workingfilectx(self._repo, path, workingctx=self,
                               filelog=filelog)