# HG changeset patch # User Matt Mackall # Date 1325713682 21600 # Node ID 0bd17a4bed88ea16c85bfe5991fe2dca45eb12af # Parent 371cff9610cdf6d6a7e1a6238ce75441b8107f03 copies: split the copies api for "normal" and merge cases (API) diff -r 371cff9610cd -r 0bd17a4bed88 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Tue Jan 03 17:13:03 2012 -0600 +++ b/mercurial/cmdutil.py Wed Jan 04 15:48:02 2012 -0600 @@ -1201,7 +1201,7 @@ def duplicatecopies(repo, rev, p1, p2): "Reproduce copies found in the source revision in the dirstate for grafts" # Here we simulate the copies and renames in the source changeset - cop, diver = copies.copies(repo, repo[rev], repo[p1], repo[p2], True) + cop, diver = copies.mergecopies(repo, repo[rev], repo[p1], repo[p2]) m1 = repo[rev].manifest() m2 = repo[p1].manifest() for k, v in cop.iteritems(): diff -r 371cff9610cd -r 0bd17a4bed88 mercurial/commands.py --- a/mercurial/commands.py Tue Jan 03 17:13:03 2012 -0600 +++ b/mercurial/commands.py Wed Jan 04 15:48:02 2012 -0600 @@ -5206,14 +5206,13 @@ changestates = zip(states, 'MAR!?IC', stat) if (opts.get('all') or opts.get('copies')) and not opts.get('no_status'): - ctxn = repo[nullid] ctx1 = repo[node1] ctx2 = repo[node2] added = stat[1] if node2 is None: added = stat[0] + stat[1] # merged? - for k, v in copies.copies(repo, ctx1, ctx2, ctxn)[0].iteritems(): + for k, v in copies.pathcopies(ctx1, ctx2).iteritems(): if k in added: copy[k] = v elif v in added: diff -r 371cff9610cd -r 0bd17a4bed88 mercurial/copies.py --- a/mercurial/copies.py Tue Jan 03 17:13:03 2012 -0600 +++ b/mercurial/copies.py Wed Jan 04 15:48:02 2012 -0600 @@ -84,7 +84,10 @@ return None return limit -def copies(repo, c1, c2, ca, checkdirs=False): +def pathcopies(c1, c2): + return mergecopies(c1._repo, c1, c2, c1._repo["null"], False)[0] + +def mergecopies(repo, c1, c2, ca, checkdirs=True): """ Find moves and copies between context c1 and c2 """ diff -r 371cff9610cd -r 0bd17a4bed88 mercurial/merge.py --- a/mercurial/merge.py Tue Jan 03 17:13:03 2012 -0600 +++ b/mercurial/merge.py Wed Jan 04 15:48:02 2012 -0600 @@ -183,7 +183,7 @@ pa = p1.p1() elif pa and repo.ui.configbool("merge", "followcopies", True): dirs = repo.ui.configbool("merge", "followdirs", True) - copy, diverge = copies.copies(repo, p1, p2, pa, dirs) + copy, diverge = copies.mergecopies(repo, p1, p2, pa, dirs) for of, fl in diverge.iteritems(): act("divergent renames", "dr", of, fl) diff -r 371cff9610cd -r 0bd17a4bed88 mercurial/patch.py --- a/mercurial/patch.py Tue Jan 03 17:13:03 2012 -0600 +++ b/mercurial/patch.py Wed Jan 04 15:48:02 2012 -0600 @@ -1600,7 +1600,7 @@ copy = {} if opts.git or opts.upgrade: - copy = copies.copies(repo, ctx1, ctx2, repo[nullid])[0] + copy = copies.pathcopies(ctx1, ctx2) difffn = lambda opts, losedata: trydiff(repo, revs, ctx1, ctx2, modified, added, removed, copy, getfilectx, opts, losedata, prefix)