D6009: context: rewrite renamed() in terms of new copysource() where appropriate

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sat Feb 23 12:09:03 EST 2019


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It's only the filectx for committed files that have the copy source's
  nodeid easily available; workingfilectx's and overlayfilectx's
  renamed() simply find the nodeid by looking in the changeset's p1's
  manifest.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6009

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1701,7 +1701,7 @@
     def data(self):
         return self._repo.wread(self._path)
     def renamed(self):
-        rp = self._repo.dirstate.copied(self._path)
+        rp = self.copysource()
         if not rp:
             return None
         return rp, self._changectx._parents[0]._manifest.get(rp, nullid)
@@ -2147,7 +2147,7 @@
         return self._parent.exists(self._path)
 
     def renamed(self):
-        path = self._parent.copydata(self._path)
+        path = self.copysource()
         if not path:
             return None
         return path, self._changectx._parents[0]._manifest.get(path, nullid)



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list