Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 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 | 8286f551b7ee |
comparison
equal
deleted
inserted
replaced
27901:29c8e35d3283 | 27902:51b6ce257e0a |
---|---|
2271 # They are not in ctx1, so We don't want to show them in the diff. | 2271 # They are not in ctx1, so We don't want to show them in the diff. |
2272 removedset.remove(f) | 2272 removedset.remove(f) |
2273 modified = sorted(modifiedset) | 2273 modified = sorted(modifiedset) |
2274 added = sorted(addedset) | 2274 added = sorted(addedset) |
2275 removed = sorted(removedset) | 2275 removed = sorted(removedset) |
2276 for dst, src in copy.items(): | |
2277 if src not in ctx1: | |
2278 # Files merged in during a merge and then copied/renamed are | |
2279 # reported as copies. We want to show them in the diff as additions. | |
2280 del copy[dst] | |
2276 | 2281 |
2277 def difffn(opts, losedata): | 2282 def difffn(opts, losedata): |
2278 return trydiff(repo, revs, ctx1, ctx2, modified, added, removed, | 2283 return trydiff(repo, revs, ctx1, ctx2, modified, added, removed, |
2279 copy, getfilectx, opts, losedata, prefix, relroot) | 2284 copy, getfilectx, opts, losedata, prefix, relroot) |
2280 if opts.upgrade and not opts.git: | 2285 if opts.upgrade and not opts.git: |