diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1558,9 +1558,10 @@ class workingctx(committablectx): parents = self._repo.dirstate.parents() p1manifest = self._repo[parents[0]].manifest() p2manifest = self._repo[parents[1]].manifest() + changedset = set(self.added()) | set(self.modified()) narrowmatch = self._repo.narrowmatch() for dst, src in self._repo.dirstate.copies().items(): - if not narrowmatch(dst): + if dst not in changedset or not narrowmatch(dst): continue if src in p1manifest: p1copies[dst] = src diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t --- a/tests/test-copies-in-changeset.t +++ b/tests/test-copies-in-changeset.t @@ -197,13 +197,37 @@ Test splitting a commit $ echo a2 > a $ hg mv b c $ hg ci -m 'modify a, move b to c' - $ (hg --config ui.interactive=yes split 2>&1 | grep mercurial.error) < y > y > n > y > EOF - mercurial.error.ProgrammingError: some copy targets missing from file list + diff --git a/a b/a + 1 hunks, 1 lines changed + examine changes to 'a'? + (enter ? for help) [Ynesfdaq?] y + + @@ -1,1 +1,1 @@ + -a + +a2 + record this change to 'a'? + (enter ? for help) [Ynesfdaq?] y + + diff --git a/b b/c + rename from b + rename to c + examine changes to 'b' and 'c'? + (enter ? for help) [Ynesfdaq?] n + + created new head + diff --git a/b b/c + rename from b + rename to c + examine changes to 'b' and 'c'? + (enter ? for help) [Ynesfdaq?] y + + saved backup bundle to $TESTTMP/split/.hg/strip-backup/9a396d463e04-2d9e6864-split.hg $ cd .. Test committing half a rename @@ -213,6 +237,5 @@ Test committing half a rename $ echo a > a $ hg ci -Aqm 'add a' $ hg mv a b - $ hg ci -m 'remove a' a 2>&1 | grep mercurial.error - mercurial.error.ProgrammingError: some copy targets missing from file list + $ hg ci -m 'remove a' a $ cd ..