Mercurial > hg-stable
changeset 27902:51b6ce257e0a
diff: don't crash when merged-in addition is copied
Similar to what was explained in the previous commit, the diff code
expected copy source to be in "ctx1", which is not always the case
during a merge. This has been broken since before hg 2.0.
Also similar to the previous commit, we fix the problem by fixing up
the copy dict.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 14 Jan 2016 10:22:55 -0800 |
parents | 29c8e35d3283 |
children | 512a814c5595 |
files | mercurial/patch.py tests/test-diffdir.t |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/patch.py Thu Jan 14 10:14:24 2016 -0800 +++ b/mercurial/patch.py Thu Jan 14 10:22:55 2016 -0800 @@ -2273,6 +2273,11 @@ 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,