diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -269,7 +269,7 @@ def rebase(ui, repo, **opts): 'resolve, then hg rebase --continue)')) finally: ui.setconfig('ui', 'forcemerge', '') - cmdutil.duplicatecopies(repo, rev, target, p2) + cmdutil.duplicatecopies(repo, rev, target) if not collapsef: newrev = concludenode(repo, rev, p1, p2, extrafn=extrafn, editor=editor) diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1198,18 +1198,10 @@ def add(ui, repo, match, dryrun, listsub 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''' diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2627,7 +2627,7 @@ def graft(ui, repo, *revs, **opts): repo.dirstate.setparents(current.node(), nullid) repo.dirstate.write() # fix up dirstate for copies and renames - cmdutil.duplicatecopies(repo, ctx.rev(), current.node(), nullid) + cmdutil.duplicatecopies(repo, ctx.rev(), current.node()) # report any conflicts if stats and stats[3] > 0: # write out state for --continue diff --git a/tests/test-graft.t b/tests/test-graft.t --- a/tests/test-graft.t +++ b/tests/test-graft.t @@ -106,14 +106,6 @@ Graft out of order, skipping a merge and b: local copied/moved to a -> m preserving b for resolve of b updating: b 1/1 files (100.00%) - searching for copies back to rev 1 - unmatched files in local: - a - unmatched files in other: - b - all copies found (* = to merge, ! = divergent): - b -> a * - checking for directory renames b b: searching for copy revision for a b: copy a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 @@ -127,12 +119,6 @@ Graft out of order, skipping a merge and e: remote is newer -> g updating: e 1/1 files (100.00%) getting e - searching for copies back to rev 1 - unmatched files in local: - c - all copies found (* = to merge, ! = divergent): - c -> b * - checking for directory renames e grafting revision 4 searching for copies back to rev 1 @@ -152,12 +138,6 @@ Graft out of order, skipping a merge and my e@77eb504366ab+ other e@9c233e8e184d ancestor e@68795b066622 warning: conflicts during merge. merging e incomplete! (edit conflicts, then use 'hg resolve --mark') - searching for copies back to rev 1 - unmatched files in local: - c - all copies found (* = to merge, ! = divergent): - c -> b * - checking for directory renames abort: unresolved conflicts, can't continue (use hg resolve and hg graft --continue) [255]