[PATCH 16 of 35 V2] context: move __iter__ from changectx

Sean Farley sean.michael.farley at gmail.com
Wed Aug 7 18:51:30 CDT 2013


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1375741338 18000
#      Mon Aug 05 17:22:18 2013 -0500
# Node ID 0a7579a062820089e64a2e16f2a2ca904a025f9a
# Parent  997098fba3ef3a3861079fc4cb97e1c8385692dd
context: move __iter__ from changectx

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -57,10 +57,14 @@
         return key in self._manifest
 
     def __getitem__(self, key):
         return self.filectx(key)
 
+    def __iter__(self):
+        for f in sorted(self._manifest):
+            yield f
+
     @propertycache
     def substate(self):
         return subrepo.state(self, self._repo.ui)
 
     def rev(self):
@@ -201,14 +205,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 __iter__(self):
-        for f in sorted(self._manifest):
-            yield f
-
     def changeset(self):
         return self._changeset
     def manifest(self):
         return self._manifest
     def manifestnode(self):


More information about the Mercurial-devel mailing list