[PATCH 15 of 36] context: move __getitem__ from changectx

Sean Farley sean.michael.farley at gmail.com
Wed Aug 7 13:13:15 CDT 2013


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1375741325 18000
#      Mon Aug 05 17:22:05 2013 -0500
# Node ID 07f80f275f7130aa72b9ed8fa38cc2f6e2e0bbb9
# Parent  20ff662fb116f1965d7fbd708720e2c23d5d9ace
context: move __getitem__ from changectx

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -54,10 +54,13 @@
         return not (self == other)
 
     def __contains__(self, key):
         return key in self._manifest
 
+    def __getitem__(self, key):
+        return self.filectx(key)
+
     @propertycache
     def substate(self):
         return subrepo.state(self, self._repo.ui)
 
     def rev(self):
@@ -192,13 +195,10 @@
         p = self._repo.changelog.parentrevs(self._rev)
         if p[1] == nullrev:
             p = p[:-1]
         return [changectx(self._repo, x) for x in p]
 
-    def __getitem__(self, key):
-        return self.filectx(key)
-
     def __iter__(self):
         for f in sorted(self._manifest):
             yield f
 
     def changeset(self):


More information about the Mercurial-devel mailing list