Mercurial > hg
changeset 15774:0bd17a4bed88
copies: split the copies api for "normal" and merge cases (API)
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 04 Jan 2012 15:48:02 -0600 |
parents | 371cff9610cd |
children | 91eb4512edd0 |
files | mercurial/cmdutil.py mercurial/commands.py mercurial/copies.py mercurial/merge.py mercurial/patch.py |
diffstat | 5 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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():
--- 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:
--- 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 """
--- 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)
--- 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)