diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -2273,6 +2273,11 @@ def diff(repo, node1=None, node2=None, m modified = sorted(modifiedset) added = sorted(addedset) removed = sorted(removedset) + for dst, src in copy.items(): + if src not in ctx1: + # Files merged in during a merge and then copied/renamed are + # reported as copies. We want to show them in the diff as additions. + del copy[dst] def difffn(opts, losedata): return trydiff(repo, revs, ctx1, ctx2, modified, added, removed, diff --git a/tests/test-diffdir.t b/tests/test-diffdir.t --- a/tests/test-diffdir.t +++ b/tests/test-diffdir.t @@ -68,3 +68,10 @@ parent 1, the diff should be relative to +++ b/a2 @@ -0,0 +1,1 @@ +foo + $ hg diff --nodates --git + diff --git a/a2 b/a2 + new file mode 100644 + --- /dev/null + +++ b/a2 + @@ -0,0 +1,1 @@ + +foo