# HG changeset patch # User Martin von Zweigbergk # Date 1522038631 25200 # Node ID c7a843aa4b423d7f357760d916d57ea6d89b9a44 # Parent e9413a3be093172e03501f2388fce4073dc26a2b context: move equivalent renamed() implementations to superclass Now that renamed() in workingfilectx and in overlayfilectx are written in terms of copysource(), they are functionally identical and can be reused. Differential Revision: https://phab.mercurial-scm.org/D6010 diff -r e9413a3be093 -r c7a843aa4b42 mercurial/context.py --- a/mercurial/context.py Sun Mar 25 21:28:30 2018 -0700 +++ b/mercurial/context.py Sun Mar 25 21:30:31 2018 -0700 @@ -1664,6 +1664,12 @@ # linked to self._changectx no matter if file is modified or not return self.rev() + def renamed(self): + path = self.copysource() + if not path: + return None + return path, self._changectx._parents[0]._manifest.get(path, nullid) + def parents(self): '''return parent filectxs, following copies if necessary''' def filenode(ctx, path): @@ -1700,11 +1706,6 @@ def data(self): return self._repo.wread(self._path) - def renamed(self): - rp = self.copysource() - if not rp: - return None - return rp, self._changectx._parents[0]._manifest.get(rp, nullid) def copysource(self): return self._repo.dirstate.copied(self._path) @@ -2146,12 +2147,6 @@ def lexists(self): return self._parent.exists(self._path) - def renamed(self): - path = self.copysource() - if not path: - return None - return path, self._changectx._parents[0]._manifest.get(path, nullid) - def copysource(self): return self._parent.copydata(self._path)