basefilectx: move ancestors from filectx
authorSean Farley <sean.michael.farley@gmail.com>
Sun, 11 Aug 2013 23:05:50 -0500
changeset 19610 0670422d58c6
parent 19609 4e72ffec8c2d
child 19611 bae0493b6dc0
basefilectx: move ancestors from filectx
mercurial/context.py
--- a/mercurial/context.py	Sun Aug 11 23:05:08 2013 -0500
+++ b/mercurial/context.py	Sun Aug 11 23:05:50 2013 -0500
@@ -710,6 +710,18 @@
 
         return None
 
+    def ancestors(self, followfirst=False):
+        visit = {}
+        c = self
+        cut = followfirst and 1 or None
+        while True:
+            for parent in c.parents()[:cut]:
+                visit[(parent.rev(), parent.node())] = parent
+            if not visit:
+                break
+            c = visit.pop(max(visit))
+            yield c
+
 class filectx(basefilectx):
     """A filecontext object makes access to data related to a particular
        filerevision convenient."""
@@ -801,18 +813,6 @@
         return [filectx(self._repo, self._path, fileid=x,
                         filelog=self._filelog) for x in c]
 
-    def ancestors(self, followfirst=False):
-        visit = {}
-        c = self
-        cut = followfirst and 1 or None
-        while True:
-            for parent in c.parents()[:cut]:
-                visit[(parent.rev(), parent.node())] = parent
-            if not visit:
-                break
-            c = visit.pop(max(visit))
-            yield c
-
     def copies(self, c2):
         if not util.safehasattr(self, "_copycache"):
             self._copycache = {}