Patchwork [11,of,48,RFC] commitablectx: move __contains__ from workingctx

login
register
mail settings
Submitter Sean Farley
Date Sept. 5, 2013, 8:07 p.m.
Message ID <4b7681f0c4a49fc5b8a4.1378411625@laptop.local>
Download mbox | patch
Permalink /patch/2349/
State Accepted
Commit 9d56a33590117e9af0fba80b16c0323b03094b9d
Headers show

Comments

Sean Farley - Sept. 5, 2013, 8:07 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1376512149 18000
#      Wed Aug 14 15:29:09 2013 -0500
# Node ID 4b7681f0c4a49fc5b8a4310b8e40d81c77c0a255
# Parent  c15013ded2f4657cb7922875cf46a066b74973f2
commitablectx: move __contains__ from workingctx

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -860,10 +860,13 @@ 
         return str(self._parents[0]) + "+"
 
     def __nonzero__(self):
         return True
 
+    def __contains__(self, key):
+        return self._repo.dirstate[key] not in "?r"
+
 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.
@@ -873,13 +876,10 @@ 
     """
     def __init__(self, repo, text="", user=None, date=None, extra=None,
                  changes=None):
         super(workingctx, self).__init__(repo, text, user, date, extra, changes)
 
-    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