changeset 45841:bff719525815

errors: set detailed exit code to 30 for config errors This is per https://www.mercurial-scm.org/wiki/ErrorCategoriesPlan. Differential Revision: https://phab.mercurial-scm.org/D9311
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 22 Oct 2020 13:56:01 -0700
parents 527ce85c2e60
children 1bf1dcbc9950
files mercurial/scmutil.py tests/test-add.t tests/test-convert-git.t tests/test-merge1.t tests/test-phases.t tests/test-repo-compengines.t
diffstat 6 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Mon Oct 12 12:44:18 2020 -0700
+++ b/mercurial/scmutil.py	Thu Oct 22 13:56:01 2020 -0700
@@ -226,6 +226,8 @@
             detailed_exit_code = 10
         elif isinstance(inst, error.StateError):
             detailed_exit_code = 20
+        elif isinstance(inst, error.ConfigError):
+            detailed_exit_code = 30
         ui.error(_(b"abort: %s\n") % inst.message)
         if inst.hint:
             ui.error(_(b"(%s)\n") % inst.hint)
--- a/tests/test-add.t	Mon Oct 12 12:44:18 2020 -0700
+++ b/tests/test-add.t	Thu Oct 22 13:56:01 2020 -0700
@@ -45,7 +45,7 @@
   $ echo foo > con.xml
   $ hg --config ui.portablefilenames=jump add con.xml
   abort: ui.portablefilenames value is invalid ('jump')
-  [255]
+  [30]
   $ hg --config ui.portablefilenames=abort add con.xml
   abort: filename contains 'con', which is reserved on Windows: con.xml
   [255]
--- a/tests/test-convert-git.t	Mon Oct 12 12:44:18 2020 -0700
+++ b/tests/test-convert-git.t	Thu Oct 22 13:56:01 2020 -0700
@@ -333,7 +333,7 @@
 input validation
   $ hg convert --config convert.git.similarity=foo --datesort git-repo2 fullrepo
   abort: convert.git.similarity is not a valid integer ('foo')
-  [255]
+  [30]
   $ hg convert --config convert.git.similarity=-1 --datesort git-repo2 fullrepo
   abort: similarity must be between 0 and 100
   [255]
--- a/tests/test-merge1.t	Mon Oct 12 12:44:18 2020 -0700
+++ b/tests/test-merge1.t	Thu Oct 22 13:56:01 2020 -0700
@@ -139,7 +139,7 @@
 bad config
   $ hg merge 1 --config merge.checkunknown=x
   abort: merge.checkunknown not valid ('x' is none of 'abort', 'ignore', 'warn')
-  [255]
+  [30]
 this merge should fail
   $ hg merge 1 --config merge.checkunknown=abort
   b: untracked file differs
--- a/tests/test-phases.t	Mon Oct 12 12:44:18 2020 -0700
+++ b/tests/test-phases.t	Thu Oct 22 13:56:01 2020 -0700
@@ -513,7 +513,7 @@
   transaction abort!
   rollback completed
   abort: phases.new-commit: not a valid phase name ('babar')
-  [255]
+  [30]
 Test phase command
 ===================
 
--- a/tests/test-repo-compengines.t	Mon Oct 12 12:44:18 2020 -0700
+++ b/tests/test-repo-compengines.t	Thu Oct 22 13:56:01 2020 -0700
@@ -131,7 +131,7 @@
   $ commitone zlib-level-invalid
   abort: storage.revlog.zlib.level is not a valid integer ('foobar')
   abort: storage.revlog.zlib.level is not a valid integer ('foobar')
-  [255]
+  [30]
 
   $ hg init zlib-level-out-of-range
   $ cat << EOF >> zlib-level-out-of-range/.hg/hgrc
@@ -188,7 +188,7 @@
   $ commitone zstd-level-invalid
   abort: storage.revlog.zstd.level is not a valid integer ('foobar')
   abort: storage.revlog.zstd.level is not a valid integer ('foobar')
-  [255]
+  [30]
 
   $ hg init zstd-level-out-of-range --config format.revlog-compression=zstd
   $ cat << EOF >> zstd-level-out-of-range/.hg/hgrc