[PATCH] committablectx: move __contains__ into workingctx

Sean Farley sean.michael.farley at gmail.com
Thu Jul 3 23:15:13 CDT 2014


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1404446497 18000
#      Thu Jul 03 23:01:37 2014 -0500
# Node ID 80ba531b638149b08849e499b12c1807d7640f7c
# Parent  13b258b21a9a2f2b37afc3f86f6d7d27b5128632
committablectx: move __contains__ into workingctx

This was mistakenly moved from workingctx to committablectx in
9d56a3359011. Since the method is querying the dirstate, the only logical place
is for it to reside is in workingctx.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -974,13 +974,10 @@ class committablectx(basectx):
         return str(self._parents[0]) + "+"
 
     def __nonzero__(self):
         return True
 
-    def __contains__(self, key):
-        return self._repo.dirstate[key] not in "?r"
-
     def _buildflagfunc(self):
         # Create a fallback function for getting file flags when the
         # filesystem doesn't support them
 
         copiesget = self._repo.dirstate.copies().get
@@ -1177,10 +1174,13 @@ class workingctx(committablectx):
         d = self._repo.dirstate
         for f in d:
             if d[f] != 'r':
                 yield f
 
+    def __contains__(self, key):
+        return self._repo.dirstate[key] not in "?r"
+
     @propertycache
     def _parents(self):
         p = self._repo.dirstate.parents()
         if p[1] == nullid:
             p = p[:-1]


More information about the Mercurial-devel mailing list