merge: additional test cases to show merge-halting behavior
authorRyan McElroy <rmcelroy@fb.com>
Fri, 06 Oct 2017 06:48:43 -0700
changeset 34884 05535d0dea68
parent 34883 c858afe9c59b
child 34885 df2ff314e36f
merge: additional test cases to show merge-halting behavior In the previous patches, we allowed the user to specify that a merge process should be halted when a filemerge fails. This patch adds tests that show additional places this logic can be utilized -- via the options to do additional post-filemerge checks to determine if a file merge was successful. Differential Revision: https://phab.mercurial-scm.org/D952
tests/test-merge-halt.t
--- a/tests/test-merge-halt.t	Wed Oct 18 04:31:46 2017 +0530
+++ b/tests/test-merge-halt.t	Fri Oct 06 06:48:43 2017 -0700
@@ -55,8 +55,13 @@
   rebase aborted
 
 Testing on-failure=prompt
-  $ echo on-failure=prompt >> $HGRCPATH
-  $ cat <<EOS | hg rebase -s 1 -d 2 --tool false --config ui.interactive=1
+  $ cat <<EOS >> $HGRCPATH
+  > [merge]
+  > on-failure=prompt
+  > [ui]
+  > interactive=1
+  > EOS
+  $ cat <<EOS | hg rebase -s 1 -d 2 --tool false
   > y
   > n
   > EOS
@@ -77,3 +82,83 @@
   $ hg rebase --abort
   rebase aborted
 
+Check that successful tool with failed post-check halts the merge
+  $ cat <<EOS >> $HGRCPATH
+  > [merge-tools]
+  > true.check=changed
+  > EOS
+  $ cat <<EOS | hg rebase -s 1 -d 2 --tool true
+  > y
+  > n
+  > n
+  > EOS
+  rebasing 1:1f28a51c3c9b "c"
+  merging a
+  merging b
+   output file a appears unchanged
+  was merge successful (yn)? y
+   output file b appears unchanged
+  was merge successful (yn)? n
+  merging b failed!
+  continue merge operation (yn)? n
+  merge halted after failed merge (see hg resolve)
+  [1]
+
+  $ hg resolve --list
+  R a
+  U b
+
+  $ hg rebase --abort
+  rebase aborted
+
+Check that conflicts with conflict check also halts the merge
+  $ cat <<EOS >> $HGRCPATH
+  > [merge-tools]
+  > true.check=conflicts
+  > true.premerge=keep
+  > [merge]
+  > on-failure=halt
+  > EOS
+  $ hg rebase -s 1 -d 2 --tool true
+  rebasing 1:1f28a51c3c9b "c"
+  merging a
+  merging b
+  merging a failed!
+  merge halted after failed merge (see hg resolve)
+  [1]
+
+  $ hg resolve --list
+  U a
+  U b
+
+  $ hg rebase --abort
+  rebase aborted
+
+Check that always-prompt also can halt the merge
+  $ cat <<EOS | hg rebase -s 1 -d 2 --tool true --config merge-tools.true.check=prompt
+  > y
+  > n
+  > EOS
+  rebasing 1:1f28a51c3c9b "c"
+  merging a
+  merging b
+  was merge of 'a' successful (yn)? y
+  was merge of 'b' successful (yn)? n
+  merging b failed!
+  merge halted after failed merge (see hg resolve)
+  [1]
+
+  $ hg resolve --list
+  R a
+  U b
+
+  $ hg rebase --abort
+  rebase aborted
+
+Check that successful tool otherwise allows the merge to continue
+  $ hg rebase -s 1 -d 2 --tool echo --keep --config merge-tools.echo.premerge=keep
+  rebasing 1:1f28a51c3c9b "c"
+  merging a
+  merging b
+  $TESTTMP/repo/a *a~base* *a~other* (glob)
+  $TESTTMP/repo/b *b~base* *b~other* (glob)