changeset 42858:170b070ec6a5

tests: demonstrate crash when committing subset of copies to changeset 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. Differential Revision: https://phab.mercurial-scm.org/D6749
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 19 Aug 2019 12:30:02 -0700
parents 3316e59b0105
children 2b869a515ba6
files tests/test-copies-in-changeset.t
diffstat 1 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-copies-in-changeset.t	Thu Aug 22 20:36:13 2019 +0300
+++ b/tests/test-copies-in-changeset.t	Mon Aug 19 12:30:02 2019 -0700
@@ -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 ..