##// END OF EJS Templates
copies: create helper for getting all copies for changeset...
Martin von Zweigbergk -
r42703:88ba0ff9 default
parent child Browse files
Show More
@@ -1247,6 +1247,28 b' def getrenamedfn(repo, endrev=None):'
1247 1247
1248 1248 return getrenamed
1249 1249
1250 def getcopiesfn(repo, endrev=None):
1251 if copiesmod.usechangesetcentricalgo(repo):
1252 def copiesfn(ctx):
1253 if ctx.p2copies():
1254 allcopies = ctx.p1copies().copy()
1255 # There should be no overlap
1256 allcopies.update(ctx.p2copies())
1257 return sorted(allcopies.items())
1258 else:
1259 return sorted(ctx.p1copies().items())
1260 else:
1261 getrenamed = getrenamedfn(repo, endrev)
1262 def copiesfn(ctx):
1263 copies = []
1264 for fn in ctx.files():
1265 rename = getrenamed(fn, ctx.rev())
1266 if rename:
1267 copies.append((fn, rename))
1268 return copies
1269
1270 return copiesfn
1271
1250 1272 def dirstatecopy(ui, repo, wctx, src, dst, dryrun=False, cwd=None):
1251 1273 """Update the dirstate to reflect the intent of copying src to dst. For
1252 1274 different reasons it might not end with dst being marked as copied from src.
@@ -301,14 +301,10 b' def showfilecopies(context, mapping):'
301 301 cache = context.resource(mapping, 'cache')
302 302 copies = context.resource(mapping, 'revcache').get('copies')
303 303 if copies is None:
304 if 'getrenamed' not in cache:
305 cache['getrenamed'] = scmutil.getrenamedfn(repo)
306 copies = []
307 getrenamed = cache['getrenamed']
308 for fn in ctx.files():
309 rename = getrenamed(fn, ctx.rev())
310 if rename:
311 copies.append((fn, rename))
304 if 'getcopies' not in cache:
305 cache['getcopies'] = scmutil.getcopiesfn(repo)
306 getcopies = cache['getcopies']
307 copies = getcopies(ctx)
312 308 return templateutil.compatfilecopiesdict(context, mapping, 'file_copy',
313 309 copies)
314 310
General Comments 0
You need to be logged in to leave comments. Login now