[PATCH 34 of 41] basefilectx: move parents from filectx

Sean Farley sean.michael.farley at gmail.com
Mon Aug 12 11:27:30 CDT 2013


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1376279841 18000
#      Sun Aug 11 22:57:21 2013 -0500
# Node ID 4e5188a63e0fc6700f002930d542a8e0af2b8881
# Parent  a3fcf44d68e93df30631dddd50fb5ec93dc64aeb
basefilectx: move parents from filectx

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -536,10 +536,22 @@
             or self.size() == fctx.size()):
             return self._filelog.cmp(self._filenode, fctx.data())
 
         return True
 
+    def parents(self):
+        p = self._path
+        fl = self._filelog
+        pl = [(p, n, fl) for n in self._filelog.parents(self._filenode)]
+
+        r = self._filelog.renamed(self._filenode)
+        if r:
+            pl[0] = (r[0], r[1], None)
+
+        return [filectx(self._repo, p, fileid=n, filelog=l)
+                for p, n, l in pl if n != nullid]
+
 class filectx(basefilectx):
     """A filecontext object makes access to data related to a particular
        filerevision convenient."""
     def __init__(self, repo, path, changeid=None, fileid=None,
                  filelog=None, changectx=None):
@@ -621,22 +633,10 @@
                     return None
             except error.LookupError:
                 pass
         return renamed
 
-    def parents(self):
-        p = self._path
-        fl = self._filelog
-        pl = [(p, n, fl) for n in self._filelog.parents(self._filenode)]
-
-        r = self._filelog.renamed(self._filenode)
-        if r:
-            pl[0] = (r[0], r[1], None)
-
-        return [filectx(self._repo, p, fileid=n, filelog=l)
-                for p, n, l in pl if n != nullid]
-
     def p1(self):
         return self.parents()[0]
 
     def p2(self):
         p = self.parents()


More information about the Mercurial-devel mailing list