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

login
register
mail settings
Submitter phabricator
Date April 13, 2019, 11:46 a.m.
Message ID <cc31079f371ce7ac3d148d961e29863e@localhost.localdomain>
Download mbox | patch
Permalink /patch/39586/
State Not Applicable
Headers show

Comments

phabricator - April 13, 2019, 11:46 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGaa84bc48c2f7: getrenamedfn: get copy data from context object if configured (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6162?vs=14574&id=14729

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

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS




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

Patch

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)