Patchwork [15,of,35,V2] context: move __getitem__ from changectx

login
register
mail settings
Submitter Sean Farley
Date Aug. 7, 2013, 11:51 p.m.
Message ID <997098fba3ef3a386107.1375919489@laptop.local>
Download mbox | patch
Permalink /patch/2068/
State Accepted
Headers show

Comments

Sean Farley - Aug. 7, 2013, 11:51 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1375741325 18000
#      Mon Aug 05 17:22:05 2013 -0500
# Node ID 997098fba3ef3a3861079fc4cb97e1c8385692dd
# Parent  394cacdf7f4fd11236044e94d847ccd82101efda
context: move __getitem__ from changectx

Patch

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):
@@ -198,13 +201,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):