##// END OF EJS Templates
errors: add config that lets user get more detailed exit codes...
errors: add config that lets user get more detailed exit codes This adds an experimental config that lets the user get more detailed exit codes. For example, there will be a specific error code for input/user errors. This is part of https://www.mercurial-scm.org/wiki/ErrorCategoriesPlan. I've made the config part of tweakdefaults. I've made the config enabled by default in tests. My reasoning is that we want to see that each specific error case gives the right exit code and we don't want to duplicate all error cases in the entire test suite. It also makes it easy to grep the `.t` files for `[255]` to find which cases we have left to fix. The logic for the current exit codes is quite simple, so I'm not too worried about regressions there. I've added a test case specifically for the "legacy" exit codes. I've set the detailed exit status only for the case of `InterventionRequired` and `SystemExit` for now (the cases where we currently return something other than 255), just to show that it works. Differential Revision: https://phab.mercurial-scm.org/D9238

File last commit:

r46430:21733e8c default
r46430:21733e8c default
Show More
test-merge-halt.t
164 lines | 3.2 KiB | text/troff | Tads3Lexer
$ cat >> $HGRCPATH <<EOF
> [extensions]
> rebase=
> [phases]
> publish=False
> [merge]
> EOF
$ hg init repo
$ cd repo
$ echo a > a
$ echo b > b
$ hg commit -qAm ab
$ echo c >> a
$ echo c >> b
$ hg commit -qAm c
$ hg up -q ".^"
$ echo d >> a
$ echo d >> b
$ hg commit -qAm d
Testing on-failure=continue
$ echo on-failure=continue >> $HGRCPATH
$ hg rebase -s 1 -d 2 --tool false
rebasing 1:1f28a51c3c9b "c"
merging a
merging b
merging a failed!
merging b failed!
unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
[240]
$ hg resolve --list
U a
U b
$ hg rebase --abort
rebase aborted
Testing on-failure=halt
$ echo on-failure=halt >> $HGRCPATH
$ hg rebase -s 1 -d 2 --tool false
rebasing 1:1f28a51c3c9b "c"
merging a
merging b
merging a failed!
merge halted after failed merge (see hg resolve)
[240]
$ hg resolve --list
U a
U b
$ hg rebase --abort
rebase aborted
Testing on-failure=prompt
$ cat <<EOS >> $HGRCPATH
> [merge]
> on-failure=prompt
> [ui]
> interactive=1
> EOS
$ cat <<EOS | hg rebase -s 1 -d 2 --tool false
> y
> n
> EOS
rebasing 1:1f28a51c3c9b "c"
merging a
merging b
merging a failed!
continue merge operation (yn)? y
merging b failed!
continue merge operation (yn)? n
merge halted after failed merge (see hg resolve)
[240]
$ hg resolve --list
U a
U b
$ 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)
[240]
$ 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)
[240]
$ 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)
[240]
$ 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)