D6162: getrenamedfn: get copy data from context object if configured

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Mar 20 15:03:28 EDT 2019


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

REVISION SUMMARY
  The function returned from getrenamedfn() calls
  filelog.renamed(). That won't work when storing copy metadata in the
  changeset.
  
  I'm just switched to a simple implementation here. We may or may not
  need to optimize it later, possibly by optimizing the callers.
  
  No more tests fail with "--extra-config-opt
  experimental.copies.read-from=compatibility)" than they did before
  this patch.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1205,6 +1205,18 @@
             wctx.copy(old, new)
 
 def getrenamedfn(repo, endrev=None):
+    if repo.ui.config('experimental', 'copies.read-from') == 'compatibility':
+        def getrenamed(fn, rev):
+            ctx = repo[rev]
+            p1copies = ctx.p1copies()
+            if fn in p1copies:
+                return p1copies[fn]
+            p2copies = ctx.p2copies()
+            if fn in p2copies:
+                return p2copies[fn]
+            return None
+        return getrenamed
+
     rcache = {}
     if endrev is None:
         endrev = len(repo)



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


More information about the Mercurial-devel mailing list