errors: add config that lets user get more detailed exit codes
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 21 Oct 2020 19:00:16 -0700
changeset 45826 21733e8c924f
parent 45825 8f07f5a9c3de
child 45827 8d72e29ad1e0
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
mercurial/configitems.py
mercurial/scmutil.py
mercurial/ui.py
tests/run-tests.py
tests/test-absorb-unfinished.t
tests/test-basic.t
tests/test-bookmarks-rebase.t
tests/test-commandserver.t
tests/test-copytrace-heuristics.t
tests/test-fix.t
tests/test-histedit-arguments.t
tests/test-histedit-edit.t
tests/test-histedit-fold.t
tests/test-histedit-no-backup.t
tests/test-histedit-obsolete.t
tests/test-largefiles-update.t
tests/test-legacy-exit-code.t
tests/test-merge-halt.t
tests/test-qrecord.t
tests/test-rebase-abort.t
tests/test-rebase-backup.t
tests/test-rebase-bookmarks.t
tests/test-rebase-check-restore.t
tests/test-rebase-collapse.t
tests/test-rebase-conflicts.t
tests/test-rebase-dest.t
tests/test-rebase-detach.t
tests/test-rebase-inmemory.t
tests/test-rebase-interruptions.t
tests/test-rebase-mq-skip.t
tests/test-rebase-mq.t
tests/test-rebase-obsolete.t
tests/test-rebase-parameters.t
tests/test-rebase-partial.t
tests/test-rebase-pull.t
tests/test-rebase-transaction.t
tests/test-resolve.t
tests/test-shelve.t
tests/test-shelve2.t
tests/test-sparse-profiles.t
tests/test-sparse.t
tests/test-state-extension.t
--- a/mercurial/configitems.py	Sat Nov 07 21:50:28 2020 -0800
+++ b/mercurial/configitems.py	Wed Oct 21 19:00:16 2020 -0700
@@ -1307,6 +1307,9 @@
     b'ui', b'editor', default=dynamicdefault,
 )
 coreconfigitem(
+    b'ui', b'detailed-exit-code', default=False, experimental=True,
+)
+coreconfigitem(
     b'ui', b'fallbackencoding', default=None,
 )
 coreconfigitem(
--- a/mercurial/scmutil.py	Sat Nov 07 21:50:28 2020 -0800
+++ b/mercurial/scmutil.py	Wed Oct 21 19:00:16 2020 -0700
@@ -148,6 +148,8 @@
     return func() if no exception happens. otherwise do some error handling
     and return an exit code accordingly. does not handle all exceptions.
     """
+    coarse_exit_code = -1
+    detailed_exit_code = -1
     try:
         try:
             return func()
@@ -212,7 +214,8 @@
         ui.error(b"%s\n" % inst)
         if inst.hint:
             ui.error(_(b"(%s)\n") % inst.hint)
-        return 1
+        detailed_exit_code = 240
+        coarse_exit_code = 1
     except error.WdirUnsupported:
         ui.error(_(b"abort: working directory revision cannot be specified\n"))
     except error.Abort as inst:
@@ -266,9 +269,13 @@
     except SystemExit as inst:
         # Commands shouldn't sys.exit directly, but give a return code.
         # Just in case catch this and and pass exit code to caller.
-        return inst.code
+        detailed_exit_code = 254
+        coarse_exit_code = inst.code
 
-    return -1
+    if ui.configbool(b'ui', b'detailed-exit-code'):
+        return detailed_exit_code
+    else:
+        return coarse_exit_code
 
 
 def checknewlabel(repo, lbl, kind):
--- a/mercurial/ui.py	Sat Nov 07 21:50:28 2020 -0800
+++ b/mercurial/ui.py	Wed Oct 21 19:00:16 2020 -0700
@@ -60,6 +60,8 @@
 # The config knobs that will be altered (if unset) by ui.tweakdefaults.
 tweakrc = b"""
 [ui]
+# Gives detailed exit codes for input/user errors, config errors, etc.
+detailed-exit-code = True
 # The rollback command is dangerous. As a rule, don't use it.
 rollback = False
 # Make `hg status` report copy information
--- a/tests/run-tests.py	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/run-tests.py	Wed Oct 21 19:00:16 2020 -0700
@@ -1439,6 +1439,7 @@
             hgrc.write(b'[ui]\n')
             hgrc.write(b'slash = True\n')
             hgrc.write(b'interactive = False\n')
+            hgrc.write(b'detailed-exit-code = True\n')
             hgrc.write(b'merge = internal:merge\n')
             hgrc.write(b'mergemarkers = detailed\n')
             hgrc.write(b'promptecho = True\n')
--- a/tests/test-absorb-unfinished.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-absorb-unfinished.t	Wed Oct 21 19:00:16 2020 -0700
@@ -21,7 +21,7 @@
   merging foo.whole
   warning: conflicts while merging foo.whole! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
   $ hg --config extensions.rebase= absorb
   abort: rebase in progress
--- a/tests/test-basic.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-basic.t	Wed Oct 21 19:00:16 2020 -0700
@@ -9,6 +9,7 @@
   lfs.usercache=$TESTTMP/.cache/lfs
   ui.slash=True
   ui.interactive=False
+  ui.detailed-exit-code=True
   ui.merge=internal:merge
   ui.mergemarkers=detailed
   ui.promptecho=True
--- a/tests/test-bookmarks-rebase.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-bookmarks-rebase.t	Wed Oct 21 19:00:16 2020 -0700
@@ -81,7 +81,7 @@
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg rebase --abort
   rebase aborted
   $ hg bookmark
@@ -96,7 +96,7 @@
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg bookmark -d three
   $ hg rebase --abort
   rebase aborted
--- a/tests/test-commandserver.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-commandserver.t	Wed Oct 21 19:00:16 2020 -0700
@@ -211,6 +211,7 @@
   lfs.usercache=$TESTTMP/.cache/lfs
   ui.slash=True
   ui.interactive=False
+  ui.detailed-exit-code=True
   ui.merge=internal:merge
   ui.mergemarkers=detailed
   ui.foo=bar
@@ -222,6 +223,7 @@
   *** runcommand -R foo showconfig ui defaults
   ui.slash=True
   ui.interactive=False
+  ui.detailed-exit-code=True
   ui.merge=internal:merge
   ui.mergemarkers=detailed
   ui.nontty=true
--- a/tests/test-copytrace-heuristics.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-copytrace-heuristics.t	Wed Oct 21 19:00:16 2020 -0700
@@ -92,7 +92,7 @@
   You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
   What do you want to do? u
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
   $ cd ..
   $ rm -rf repo
@@ -249,7 +249,7 @@
   You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
   What do you want to do? u
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
   $ hg rebase --abort
   rebase aborted
@@ -711,7 +711,7 @@
   You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
   What do you want to do? u
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
 But when we have "sourcecommitlimit > (no. of drafts from base to c1)", we do
 fullcopytracing
--- a/tests/test-fix.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-fix.t	Wed Oct 21 19:00:16 2020 -0700
@@ -869,7 +869,7 @@
   merging foo.whole
   warning: conflicts while merging foo.whole! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
   $ hg --config extensions.rebase= fix --working-dir
   abort: unresolved conflicts
--- a/tests/test-histedit-arguments.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-histedit-arguments.t	Wed Oct 21 19:00:16 2020 -0700
@@ -151,7 +151,7 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   Editing (08d98a8350f3), you may commit or record as needed now.
   (hg histedit --continue to resume)
-  [1]
+  [240]
 
   $ hg graft --continue
   abort: no graft in progress
@@ -337,7 +337,7 @@
   > EOF
   Editing (eb57da33312f), you may commit or record as needed now.
   (hg histedit --continue to resume)
-  [1]
+  [240]
   $ echo edit >> alpha
   $ hg histedit -q --continue
   $ hg log -G -T '{rev}:{node|short} {desc}'
@@ -364,7 +364,7 @@
   > EOF
   Editing (8fda0c726bf2), you may commit or record as needed now.
   (hg histedit --continue to resume)
-  [1]
+  [240]
 Corrupt histedit state file
   $ sed 's/8fda0c726bf2/123456789012/' .hg/histedit-state > ../corrupt-histedit
   $ mv ../corrupt-histedit .hg/histedit-state
@@ -489,7 +489,7 @@
   warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
   Fix up the change (pick 8cde254db839)
   (hg histedit --continue to resume)
-  [1]
+  [240]
   $ hg resolve -m --all
   (no more unresolved files)
   continue: hg histedit --continue
@@ -498,7 +498,7 @@
   warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
   Editing (6f2f0241f119), you may commit or record as needed now.
   (hg histedit --continue to resume)
-  [1]
+  [240]
   $ hg resolve -m --all
   (no more unresolved files)
   continue: hg histedit --continue
--- a/tests/test-histedit-edit.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-histedit-edit.t	Wed Oct 21 19:00:16 2020 -0700
@@ -437,7 +437,7 @@
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   Editing (cb9a9f314b8b), you may commit or record as needed now.
   (hg histedit --continue to resume)
-  [1]
+  [240]
   $ HGEDITOR=true hg histedit --continue
   saved backup bundle to $TESTTMP/r0/.hg/strip-backup/cb9a9f314b8b-cc5ccb0b-histedit.hg
 
--- a/tests/test-histedit-fold.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-histedit-fold.t	Wed Oct 21 19:00:16 2020 -0700
@@ -291,7 +291,7 @@
   warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
   Fix up the change (fold 251d831eeec5)
   (hg histedit --continue to resume)
-  [1]
+  [240]
 There were conflicts, we keep P1 content. This
 should effectively drop the changes from +6.
 
@@ -364,7 +364,7 @@
   warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
   Fix up the change (fold 251d831eeec5)
   (hg histedit --continue to resume)
-  [1]
+  [240]
   $ cat > file << EOF
   > 1
   > 2
--- a/tests/test-histedit-no-backup.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-histedit-no-backup.t	Wed Oct 21 19:00:16 2020 -0700
@@ -52,7 +52,7 @@
   merging file
   Editing (7d5187087c79), you may commit or record as needed now.
   (hg histedit --continue to resume)
-  [1]
+  [240]
   $ hg abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/foo/.hg/strip-backup/1d8f701c7b35-cf7be322-backup.hg
@@ -74,7 +74,7 @@
   merging file
   Editing (7d5187087c79), you may commit or record as needed now.
   (hg histedit --continue to resume)
-  [1]
+  [240]
 
   $ hg abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-histedit-obsolete.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-histedit-obsolete.t	Wed Oct 21 19:00:16 2020 -0700
@@ -45,7 +45,7 @@
   $ hg histedit -r 'all()' --commands plan
   Editing (1b2d564fad96), you may commit or record as needed now.
   (hg histedit --continue to resume)
-  [1]
+  [240]
   $ hg st
   A b
   A c
@@ -72,7 +72,7 @@
   $ hg histedit -r 'all()' --commands plan
   Editing (49d44ab2be1b), you may commit or record as needed now.
   (hg histedit --continue to resume)
-  [1]
+  [240]
   $ hg st
   A b
   A d
@@ -227,7 +227,7 @@
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   Editing (b346ab9a313d), you may commit or record as needed now.
   (hg histedit --continue to resume)
-  [1]
+  [240]
   $ echo c >> c
   $ hg histedit --continue
   1 new orphan changesets
@@ -361,7 +361,7 @@
   0 files updated, 0 files merged, 6 files removed, 0 files unresolved
   Editing (b449568bf7fc), you may commit or record as needed now.
   (hg histedit --continue to resume)
-  [1]
+  [240]
   $ echo f >> f
   $ hg histedit --continue
   $ hg log -G
@@ -403,7 +403,7 @@
   0 files updated, 0 files merged, 6 files removed, 0 files unresolved
   Editing (b449568bf7fc), you may commit or record as needed now.
   (hg histedit --continue to resume)
-  [1]
+  [240]
   $ echo f >> f
   $ hg histedit --continue
   $ hg log -G
@@ -529,7 +529,7 @@
   > EOF
   Editing (ee118ab9fa44), you may commit or record as needed now.
   (hg histedit --continue to resume)
-  [1]
+  [240]
 
 #if abortcommand
 when in dry-run mode
@@ -568,7 +568,7 @@
   > EOF
   Editing (ee118ab9fa44), you may commit or record as needed now.
   (hg histedit --continue to resume)
-  [1]
+  [240]
   $ hg histedit --continue --config experimental.evolution.track-operation=1
   $ hg log -G
   @  23:175d6b286a22 (secret) k
--- a/tests/test-largefiles-update.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-largefiles-update.t	Wed Oct 21 19:00:16 2020 -0700
@@ -594,7 +594,7 @@
   merging normal1
   warning: conflicts while merging normal1! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ cat .hglf/large1
   58e24f733a964da346e2407a2bee99d9001184f5
   $ cat large1
@@ -762,7 +762,7 @@
   > hgext.largefiles.lfutil.getlfilestoupdate = getlfilestoupdate
   > EOF
   $ hg up -Cr "8" --config extensions.crashupdatelfiles=../crashupdatelfiles.py
-  [7]
+  [254]
 Check large1 content and status ... and that update will undo modifications:
   $ cat large1
   large1 in #3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-legacy-exit-code.t	Wed Oct 21 19:00:16 2020 -0700
@@ -0,0 +1,49 @@
+Tests that the exit code is as expected when ui.detailed-exit-code is *not*
+enabled.
+
+  $ cat >> $HGRCPATH << EOF
+  > [ui]
+  > detailed-exit-code=no
+  > EOF
+
+  $ hg init
+  $ echo a > a
+Expect exit code 0 on success
+  $ hg ci -Aqm initial
+
+  $ hg co nonexistent
+  abort: unknown revision 'nonexistent'!
+  [255]
+
+  $ hg co 'none()'
+  abort: empty revision set
+  [255]
+
+  $ hg co 'invalid('
+  hg: parse error at 8: not a prefix: end
+  (invalid(
+           ^ here)
+  [255]
+
+  $ hg co 'invalid('
+  hg: parse error at 8: not a prefix: end
+  (invalid(
+           ^ here)
+  [255]
+
+  $ hg continue
+  abort: no operation in progress
+  [255]
+
+  $ hg st --config a=b
+  abort: malformed --config option: 'a=b' (use --config section.name=value)
+  [255]
+
+  $ echo b > a
+  $ hg ci -m second
+  $ echo c > a
+  $ hg ci -m third
+  $ hg --config extensions.rebase= rebase -r . -d 0 -q
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
+  [1]
--- a/tests/test-merge-halt.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-merge-halt.t	Wed Oct 21 19:00:16 2020 -0700
@@ -28,7 +28,7 @@
   merging a failed!
   merging b failed!
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
   $ hg resolve --list
   U a
@@ -45,7 +45,7 @@
   merging b
   merging a failed!
   merge halted after failed merge (see hg resolve)
-  [1]
+  [240]
 
   $ hg resolve --list
   U a
@@ -73,7 +73,7 @@
   merging b failed!
   continue merge operation (yn)? n
   merge halted after failed merge (see hg resolve)
-  [1]
+  [240]
 
   $ hg resolve --list
   U a
@@ -102,7 +102,7 @@
   merging b failed!
   continue merge operation (yn)? n
   merge halted after failed merge (see hg resolve)
-  [1]
+  [240]
 
   $ hg resolve --list
   R a
@@ -125,7 +125,7 @@
   merging b
   merging a failed!
   merge halted after failed merge (see hg resolve)
-  [1]
+  [240]
 
   $ hg resolve --list
   U a
@@ -146,7 +146,7 @@
   was merge of 'b' successful (yn)? n
   merging b failed!
   merge halted after failed merge (see hg resolve)
-  [1]
+  [240]
 
   $ hg resolve --list
   R a
--- a/tests/test-qrecord.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-qrecord.t	Wed Oct 21 19:00:16 2020 -0700
@@ -458,7 +458,7 @@
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   Editing (ea55e2ae468f), you may commit or record as needed now.
   (hg histedit --continue to resume)
-  [1]
+  [240]
   $ echo 'foo bar' > a
   $ hg qrecord -d '0 0' -m aaa a.patch <<EOF
   > y
--- a/tests/test-rebase-abort.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-rebase-abort.t	Wed Oct 21 19:00:16 2020 -0700
@@ -82,7 +82,7 @@
   merging common
   warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
 Insert unsupported advisory merge record:
 
@@ -149,7 +149,7 @@
   merging common
   warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
   $ mv .hg/rebasestate .hg/rebasestate.back
   $ hg update --quiet --clean 2
@@ -219,7 +219,7 @@
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
   $ hg tglog
   %  4:draft 'C1'
@@ -278,7 +278,7 @@
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg abort
   rebase aborted
   $ hg log -G --template "{rev} {desc} {bookmarks}"
@@ -316,7 +316,7 @@
   $ hg rebase -d @ -b foo --tool=internal:fail
   rebasing 2:070cf4580bb5 foo tip "b2"
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
   $ mv .hg/rebasestate ./ # so we're allowed to hg up like in mercurial <2.6.3
   $ hg up -C 0            # user does other stuff in the repo
@@ -463,7 +463,7 @@
   $ hg rebase -d 1 --tool 'internal:fail'
   rebasing 2:e4ea5cdc9789 "conflicting 1"
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg abort
   rebase aborted
   $ hg summary
@@ -504,7 +504,7 @@
   note: not rebasing 3:0682fd3dabf5 "disappear draft", its destination already has all its changes
   warning: conflicts while merging root! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg abort
   rebase aborted
   $ cd ..
--- a/tests/test-rebase-backup.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-rebase-backup.t	Wed Oct 21 19:00:16 2020 -0700
@@ -127,7 +127,7 @@
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg rebase --abort
   saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/818c1a43c916-2b644d96-backup.hg
   rebase aborted
@@ -143,7 +143,7 @@
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg rebase --abort
   rebase aborted
   $ cd ..
--- a/tests/test-rebase-bookmarks.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-rebase-bookmarks.t	Wed Oct 21 19:00:16 2020 -0700
@@ -173,7 +173,7 @@
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ echo 'c' > c
   $ hg resolve --mark c
   (no more unresolved files)
--- a/tests/test-rebase-check-restore.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-rebase-check-restore.t	Wed Oct 21 19:00:16 2020 -0700
@@ -70,7 +70,7 @@
   merging A
   warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
 Solve the conflict and go on:
 
@@ -127,7 +127,7 @@
   merging A
   warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
 Solve the conflict and go on:
 
--- a/tests/test-rebase-collapse.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-rebase-collapse.t	Wed Oct 21 19:00:16 2020 -0700
@@ -292,7 +292,7 @@
   You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
   What do you want to do? u
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
   $ echo F > E
   $ hg resolve -m
@@ -659,7 +659,7 @@
   merging A
   warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ rm A.orig
   $ hg resolve --mark A
   (no more unresolved files)
@@ -706,7 +706,7 @@
   merging A
   warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg tglog
   o  3: 63668d570d21 'C'
   |
@@ -734,7 +734,7 @@
   merging A
   warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg tglog
   %  3: 63668d570d21 'C'
   |
--- a/tests/test-rebase-conflicts.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-rebase-conflicts.t	Wed Oct 21 19:00:16 2020 -0700
@@ -67,7 +67,7 @@
   merging common
   warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
   $ hg status --config commands.status.verbose=1
   M common
@@ -345,7 +345,7 @@
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg diff
   diff -r 328e4ab1f7cc a
   --- a/a	Thu Jan 01 00:00:00 1970 +0000
@@ -365,7 +365,7 @@
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg diff
   diff -r 328e4ab1f7cc a
   --- a/a	Thu Jan 01 00:00:00 1970 +0000
@@ -403,7 +403,7 @@
   merging B
   warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
   $ echo 4 > B
   $ hg resolve -m
@@ -455,7 +455,7 @@
   merging conflict
   warning: conflicts while merging conflict! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg tglog
   @  8:draft 'E'
   |
--- a/tests/test-rebase-dest.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-rebase-dest.t	Wed Oct 21 19:00:16 2020 -0700
@@ -49,7 +49,7 @@
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ echo d > c
   $ hg resolve --mark --all
   (no more unresolved files)
--- a/tests/test-rebase-detach.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-rebase-detach.t	Wed Oct 21 19:00:16 2020 -0700
@@ -298,7 +298,7 @@
   merging B
   warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg resolve --all -t internal:local
   (no more unresolved files)
   continue: hg rebase --continue
--- a/tests/test-rebase-inmemory.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-rebase-inmemory.t	Wed Oct 21 19:00:16 2020 -0700
@@ -465,7 +465,7 @@
   merging e
   warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg rebase --abort
   saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/c1e524d4287c-f91f82e1-backup.hg
   rebase aborted
@@ -856,7 +856,7 @@
   merging foo
   warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
   $ cd $TESTTMP
 
@@ -889,7 +889,7 @@
   merging foo
   warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg rebase -r 3 -d 1 -t:merge3
   abort: rebase in progress
   (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
--- a/tests/test-rebase-interruptions.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-rebase-interruptions.t	Wed Oct 21 19:00:16 2020 -0700
@@ -62,7 +62,7 @@
   merging A
   warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
 Force a commit on C during the interruption:
 
@@ -99,7 +99,7 @@
   merging A
   warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
 Solve the conflict and go on:
 
@@ -158,7 +158,7 @@
   merging A
   warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
 Force a commit on B' during the interruption:
 
@@ -230,7 +230,7 @@
   merging A
   warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
 Change phase on B and B'
 
@@ -303,7 +303,7 @@
   merging A
   warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg tglog
   @  5: 45396c49d53b 'B'
   |
@@ -506,7 +506,7 @@
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ echo a > a
   $ echo c >> a
   $ hg resolve --mark a
@@ -526,7 +526,7 @@
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ echo a > a
   $ echo c >> a
   $ hg resolve --mark a
--- a/tests/test-rebase-mq-skip.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-rebase-mq-skip.t	Wed Oct 21 19:00:16 2020 -0700
@@ -156,7 +156,7 @@
   note: not rebasing 3:6ff5b8feed8e r3 "r3", its destination already has all its changes
   rebasing 4:094320fec554 r4 "r4"
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
   $ HGMERGE=internal:local hg resolve --all
   (no more unresolved files)
--- a/tests/test-rebase-mq.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-rebase-mq.t	Wed Oct 21 19:00:16 2020 -0700
@@ -63,7 +63,7 @@
   merging f
   warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
 Fix the 1st conflict:
 
@@ -77,7 +77,7 @@
   merging f
   warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
 Fix the 2nd conflict:
 
--- a/tests/test-rebase-obsolete.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-rebase-obsolete.t	Wed Oct 21 19:00:16 2020 -0700
@@ -1033,7 +1033,7 @@
   merging willconflict
   warning: conflicts while merging willconflict! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
   $ hg resolve --mark willconflict
   (no more unresolved files)
@@ -1788,7 +1788,7 @@
   merging D
   warning: conflicts while merging D! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
   $ cp -R . $TESTTMP/hidden-state2
 
@@ -1875,7 +1875,7 @@
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg rebase --stop
   1 new orphan changesets
   $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
@@ -1937,7 +1937,7 @@
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg rebase --stop
   abort: cannot remove original changesets with unrebased descendants
   (either enable obsmarkers to allow unstable revisions or use --keep to keep original changesets)
@@ -1955,7 +1955,7 @@
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg rebase --stop
   $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
   o  7:7fffad344617 test
@@ -2017,7 +2017,7 @@
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg rebase --stop
   abort: cannot stop in --collapse session
   [255]
@@ -2050,7 +2050,7 @@
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg rebase --stop --dry-run
   abort: cannot specify both --stop and --dry-run
   [255]
@@ -2118,7 +2118,7 @@
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg rebase --stop
   1 new orphan changesets
   $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
--- a/tests/test-rebase-parameters.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-rebase-parameters.t	Wed Oct 21 19:00:16 2020 -0700
@@ -480,7 +480,7 @@
   $ hg rebase -s 2 -d 1 --tool internal:fail
   rebasing 2:e4e3f3546619 tip "c2b"
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
   $ hg summary
   parent: 1:56daeba07f4b 
--- a/tests/test-rebase-partial.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-rebase-partial.t	Wed Oct 21 19:00:16 2020 -0700
@@ -85,7 +85,7 @@
   merging file
   warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg rebase --abort
   rebase aborted
   $ hg tglog
--- a/tests/test-rebase-pull.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-rebase-pull.t	Wed Oct 21 19:00:16 2020 -0700
@@ -90,7 +90,7 @@
   > EOF
   Editing (d80cc2da061e), you may commit or record as needed now.
   (hg histedit --continue to resume)
-  [1]
+  [240]
   $ hg pull --rebase
   abort: histedit in progress
   (use 'hg histedit --continue' or 'hg histedit --abort')
--- a/tests/test-rebase-transaction.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-rebase-transaction.t	Wed Oct 21 19:00:16 2020 -0700
@@ -108,7 +108,7 @@
   merging conflict
   warning: conflicts while merging conflict! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ hg tglog
   o  5: D
   |
--- a/tests/test-resolve.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-resolve.t	Wed Oct 21 19:00:16 2020 -0700
@@ -464,7 +464,7 @@
   warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark')
   warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
 Test when commands.resolve.confirm config option is not set:
 ===========================================================
--- a/tests/test-shelve.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-shelve.t	Wed Oct 21 19:00:16 2020 -0700
@@ -366,7 +366,7 @@
   merging a/a
   warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
-  [1]
+  [240]
   $ hg status -v
   M a/a
   M b.rename/b
@@ -484,7 +484,7 @@
   $ hg unshelve -q
   warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
-  [1]
+  [240]
 
 attempt to continue
 
@@ -705,7 +705,7 @@
   merging a/a
   warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
-  [1]
+  [240]
   $ hg bookmark
      test                      (4|13):33f7f61e6c5e (re)
 
@@ -1387,7 +1387,7 @@
   warning: conflicts while merging bar1! (edit, then use 'hg resolve --mark')
   warning: conflicts while merging bar2! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
-  [1]
+  [240]
 
   $ cat > bar1 <<EOF
   > A
--- a/tests/test-shelve2.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-shelve2.t	Wed Oct 21 19:00:16 2020 -0700
@@ -219,7 +219,7 @@
   merging f
   warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
-  [1]
+  [240]
 
 #if phasebased
   $ hg log -G --template '{rev}  {desc|firstline}  {author}  {date|isodate}'
@@ -290,7 +290,7 @@
   merging f
   warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
-  [1]
+  [240]
   $ hg st
   M f
   ? f.orig
@@ -345,7 +345,7 @@
   $ hg unshelve -q --config 'ui.origbackuppath=.hg/origbackups'
   warning: conflicts while merging root! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
-  [1]
+  [240]
   $ ls .hg/origbackups
   root
   $ rm -rf .hg/origbackups
@@ -563,7 +563,7 @@
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
-  [1]
+  [240]
   $ echo "aaabbbccc" > a
   $ rm a.orig
   $ hg resolve --mark a
@@ -637,7 +637,7 @@
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
-  [1]
+  [240]
 
 Removing restore branch information from shelvedstate file(making it looks like
 in previous versions) and running unshelve --continue
@@ -715,7 +715,7 @@
   merging file
   warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
-  [1]
+  [240]
   $ echo somethingsomething > .hg/shelvedstate
 
 Unshelve --continue fails with appropriate message if shelvedstate is corrupted
@@ -762,7 +762,7 @@
   merging file
   warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
-  [1]
+  [240]
   $ hg resolve --mark file
   (no more unresolved files)
   continue: hg unshelve --continue
@@ -819,7 +819,7 @@
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
-  [1]
+  [240]
 putting v1 shelvedstate file in place of a created v2
   $ cat << EOF > .hg/shelvedstate
   > 1
@@ -860,7 +860,7 @@
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
-  [1]
+  [240]
   $ hg abort
   unshelve of 'default' aborted
 
@@ -877,7 +877,7 @@
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
-  [1]
+  [240]
   $ cat .hg/shelved/default.shelve
   node=82e0cb9893247d12667017593ce1e5655860f1ac
   $ hg abort
@@ -905,7 +905,7 @@
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
-  [1]
+  [240]
 
   $ hg log --template '{desc|firstline}  {author}  {date|isodate} \n' -r .
   pending changes temporary commit  shelve@localhost  1970-01-01 00:00 +0000 
@@ -934,7 +934,7 @@
   $ hg unshelve -q
   warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
-  [1]
+  [240]
   $ cat foo
   r0
   <<<<<<< working-copy: 0b2fcf2a90e9 - shelve: pending changes temporary commit
--- a/tests/test-sparse-profiles.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-sparse-profiles.t	Wed Oct 21 19:00:16 2020 -0700
@@ -201,7 +201,7 @@
   warning: conflicts while merging backend.sparse! (edit, then use 'hg resolve --mark')
   warning: conflicts while merging data.py! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
   $ rm *.orig
   $ ls -A
   .hg
--- a/tests/test-sparse.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-sparse.t	Wed Oct 21 19:00:16 2020 -0700
@@ -201,7 +201,7 @@
   merging hide
   warning: conflicts while merging hide! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
-  [1]
+  [240]
 
   $ hg debugsparse
   [exclude]
--- a/tests/test-state-extension.t	Sat Nov 07 21:50:28 2020 -0800
+++ b/tests/test-state-extension.t	Wed Oct 21 19:00:16 2020 -0700
@@ -101,7 +101,7 @@
   merging file1
   warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg chainify --continue')
-  [1]
+  [240]
   $ hg status --config commands.status.verbose=True
   M file1
   ? file1.orig