comparison mercurial/scmutil.py @ 42114:aa84bc48c2f7

getrenamedfn: get copy data from context object if configured The function returned from getrenamedfn() calls filelog.renamed(). That won't work when storing copy metadata in the changeset. I've 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. Differential Revision: https://phab.mercurial-scm.org/D6162
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 18 Jan 2019 13:13:48 -0800
parents ad4a3e2eedb3
children 27475ae67676
comparison
equal deleted inserted replaced
42113:f0def07fa82f 42114:aa84bc48c2f7
1203 wctx.add(unknown) 1203 wctx.add(unknown)
1204 for new, old in renames.iteritems(): 1204 for new, old in renames.iteritems():
1205 wctx.copy(old, new) 1205 wctx.copy(old, new)
1206 1206
1207 def getrenamedfn(repo, endrev=None): 1207 def getrenamedfn(repo, endrev=None):
1208 if repo.ui.config('experimental', 'copies.read-from') == 'compatibility':
1209 def getrenamed(fn, rev):
1210 ctx = repo[rev]
1211 p1copies = ctx.p1copies()
1212 if fn in p1copies:
1213 return p1copies[fn]
1214 p2copies = ctx.p2copies()
1215 if fn in p2copies:
1216 return p2copies[fn]
1217 return None
1218 return getrenamed
1219
1208 rcache = {} 1220 rcache = {}
1209 if endrev is None: 1221 if endrev is None:
1210 endrev = len(repo) 1222 endrev = len(repo)
1211 1223
1212 def getrenamed(fn, rev): 1224 def getrenamed(fn, rev):