[PATCH 36 of 41] basefilectx: move p2 from filectx
Sean Farley
sean.michael.farley at gmail.com
Mon Aug 12 11:27:32 CDT 2013
# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1376280011 18000
# Sun Aug 11 23:00:11 2013 -0500
# Node ID adb0ddbdca0f5b7c8f029c0a40d70f3602c9bc06
# Parent 3f092041ba827e9e278d4e1d3d6fdad2d3cd8c7c
basefilectx: move p2 from filectx
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -551,10 +551,16 @@
for p, n, l in pl if n != nullid]
def p1(self):
return self.parents()[0]
+ def p2(self):
+ p = self.parents()
+ if len(p) == 2:
+ return p[1]
+ return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog)
+
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):
@@ -636,16 +642,10 @@
return None
except error.LookupError:
pass
return renamed
- def p2(self):
- p = self.parents()
- if len(p) == 2:
- return p[1]
- return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog)
-
def children(self):
# hard for renames
c = self._filelog.children(self._filenode)
return [filectx(self._repo, self._path, fileid=x,
filelog=self._filelog) for x in c]
More information about the Mercurial-devel
mailing list