From patchwork Tue Aug 20 16:29:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D6749: tests: demonstrate crash when committing subset of copies to changeset From: phabricator X-Patchwork-Id: 41362 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Tue, 20 Aug 2019 16:29:19 +0000 martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY When writing copy metadata to the changeset and not committing all copies in the dirstate, we get a ProgrammingError. This commit adds two tests showing how to trigger this bug. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6749 AFFECTED FILES tests/test-copies-in-changeset.t CHANGE DETAILS To: martinvonz, #hg-reviewers Cc: mercurial-devel 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 @@ -10,6 +10,7 @@ > showcopies = log -r . -T '{file_copies % "{source} -> {name}\n"}' > [extensions] > rebase = + > split = > EOF Check that copies are recorded correctly @@ -185,3 +186,33 @@ a R a $ cd .. + +Test splitting a commit + + $ hg init split + $ cd split + $ echo a > a + $ echo b > b + $ hg ci -Aqm 'add a and b' + $ 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 + $ cd .. + +Test committing half a rename + + $ hg init partial + $ cd partial + $ 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 + $ cd ..