# HG changeset patch # User Sean Farley # Date 2013-08-12 03:57:21 # Node ID cf7322cb1c13b7598e9a083a6a262b7fe285bb66 # Parent ef7c47e4002f31afc516d6d005b28ec4f08ff4b8 basefilectx: move parents from filectx diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -538,6 +538,18 @@ class basefilectx(object): 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.""" @@ -623,18 +635,6 @@ class filectx(basefilectx): 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]