Patchwork [34,of,41] basefilectx: move parents from filectx

login
register
mail settings
Submitter Sean Farley
Date Aug. 12, 2013, 4:27 p.m.
Message ID <4e5188a63e0fc6700f00.1376324850@laptop.local>
Download mbox | patch
Permalink /patch/2161/
State Accepted
Commit cf7322cb1c13b7598e9a083a6a262b7fe285bb66
Headers show

Comments

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

Patch

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()