Patchwork D6749: tests: demonstrate crash when committing subset of copies to changeset

login
register
mail settings
Submitter phabricator
Date Aug. 20, 2019, 4:29 p.m.
Message ID <differential-rev-PHID-DREV-rxx5w7lsuvbqs3sb3sht-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/41362/
State Superseded
Headers show

Comments

phabricator - Aug. 20, 2019, 4:29 p.m.
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

Patch

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) <<EOF
+  > 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 ..