Mercurial > hg-stable
diff mercurial/cmdutil.py @ 15777:12309c09d19a
cmdutil: simplify duplicatecopies
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 05 Jan 2012 20:35:10 -0600 |
parents | 0bd17a4bed88 |
children | 51fc43253a52 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Thu Jan 05 14:14:12 2012 -0600 +++ b/mercurial/cmdutil.py Thu Jan 05 20:35:10 2012 -0600 @@ -1198,18 +1198,10 @@ bad.extend(f for f in rejected if f in match.files()) return bad -def duplicatecopies(repo, rev, p1, p2): +def duplicatecopies(repo, rev, p1): "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.mergecopies(repo, repo[rev], repo[p1], repo[p2]) - m1 = repo[rev].manifest() - m2 = repo[p1].manifest() - for k, v in cop.iteritems(): - if k in m1: - if v in m1 or v in m2: - repo.dirstate.copy(v, k) - if v in m2 and v not in m1 and k in m2: - repo.dirstate.remove(v) + for dst, src in copies.pathcopies(repo[p1], repo[rev]).iteritems(): + repo.dirstate.copy(src, dst) def commit(ui, repo, commitfunc, pats, opts): '''commit the specified files or all outstanding changes'''