# HG changeset patch # User Martin von Zweigbergk # Date 1550213178 28800 # Node ID d5edb5d3a337b85f56c3efc448482af87c9df3c2 # Parent 3158cb74fbca815d615c7b7419b692ff0188672f copies: filter out copies when target is not in destination manifest When chaining a series of commits that copied a file with a series that removed the destination file, we would still include the copy in the result. Similar to the previous patch, I have checked that `hg status --copies` is not affected by this bug, but I wouldn't be surprised if some commands are. Differential Revision: https://phab.mercurial-scm.org/D5989 diff -r 3158cb74fbca -r d5edb5d3a337 mercurial/copies.py --- a/mercurial/copies.py Tue Feb 19 10:45:22 2019 -0800 +++ b/mercurial/copies.py Thu Feb 14 22:46:18 2019 -0800 @@ -124,10 +124,13 @@ # file is a copy of an existing file t[k] = v - # remove criss-crossed copies for k, v in list(t.items()): + # remove criss-crossed copies if k in src and v in dst: del t[k] + # remove copies to files that were then removed + elif k not in dst: + del t[k] return t diff -r 3158cb74fbca -r d5edb5d3a337 tests/test-copies.t --- a/tests/test-copies.t Tue Feb 19 10:45:22 2019 -0800 +++ b/tests/test-copies.t Thu Feb 14 22:46:18 2019 -0800 @@ -194,9 +194,7 @@ |/ x y o 0 add x x -BROKEN: x doesn't exist here $ hg debugpathcopies 1 2 - y -> x Copies via null revision (there shouldn't be any) $ newrepo