changeset 48368:8c4881c07f57

errors: use detailed exit code for RepoLookupError Differential Revision: https://phab.mercurial-scm.org/D11829
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 19 Nov 2021 16:16:21 -0800
parents 0b8e076e878c
children 35f1ecd84bd0
files mercurial/scmutil.py tests/test-bookmarks-current.t tests/test-bookmarks-pushpull.t tests/test-bookmarks.t tests/test-branch-option.t tests/test-bundle.t tests/test-commandserver.t tests/test-dispatch.t tests/test-infinitepush-ci.t tests/test-log-bookmark.t tests/test-log.t tests/test-obsolete-distributed.t tests/test-pull-r.t tests/test-remotefilelog-repack.t tests/test-revset.t tests/test-revset2.t tests/test-static-http.t tests/test-template-functions.t
diffstat 18 files changed, 29 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Fri Nov 19 15:40:56 2021 -0800
+++ b/mercurial/scmutil.py	Fri Nov 19 16:16:21 2021 -0800
@@ -180,6 +180,8 @@
             )
         )
     except error.RepoError as inst:
+        if isinstance(inst, error.RepoLookupError):
+            detailed_exit_code = 10
         ui.error(_(b"abort: %s\n") % inst)
         if inst.hint:
             ui.error(_(b"(%s)\n") % inst.hint)
--- a/tests/test-bookmarks-current.t	Fri Nov 19 15:40:56 2021 -0800
+++ b/tests/test-bookmarks-current.t	Fri Nov 19 16:16:21 2021 -0800
@@ -245,4 +245,4 @@
   $ hg bookmarks --inactive
   $ hg bookmarks -ql .
   abort: no active bookmark
-  [255]
+  [10]
--- a/tests/test-bookmarks-pushpull.t	Fri Nov 19 15:40:56 2021 -0800
+++ b/tests/test-bookmarks-pushpull.t	Fri Nov 19 16:16:21 2021 -0800
@@ -357,7 +357,7 @@
   (leaving bookmark V)
   $ hg push -B . ../a
   abort: no active bookmark
-  [255]
+  [10]
   $ hg update -r V
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   (activating bookmark V)
--- a/tests/test-bookmarks.t	Fri Nov 19 15:40:56 2021 -0800
+++ b/tests/test-bookmarks.t	Fri Nov 19 16:16:21 2021 -0800
@@ -278,7 +278,7 @@
   $ hg book -i rename-me
   $ hg book -m . renamed
   abort: no active bookmark
-  [255]
+  [10]
   $ hg up -q Y
   $ hg book -d rename-me
 
@@ -298,7 +298,7 @@
   $ hg book -i delete-me
   $ hg book -d .
   abort: no active bookmark
-  [255]
+  [10]
   $ hg up -q Y
   $ hg book -d delete-me
 
--- a/tests/test-branch-option.t	Fri Nov 19 15:40:56 2021 -0800
+++ b/tests/test-branch-option.t	Fri Nov 19 16:16:21 2021 -0800
@@ -58,12 +58,12 @@
 
   $ hg in -qbz
   abort: unknown branch 'z'
-  [255]
+  [10]
   $ hg in -q ../branch#z
   2:f25d57ab0566
   $ hg out -qbz
   abort: unknown branch 'z'
-  [255]
+  [10]
 
 in rev c branch a
 
--- a/tests/test-bundle.t	Fri Nov 19 15:40:56 2021 -0800
+++ b/tests/test-bundle.t	Fri Nov 19 16:16:21 2021 -0800
@@ -716,7 +716,7 @@
   $ hg incoming '../test#bundle.hg'
   comparing with ../test
   abort: unknown revision 'bundle.hg'
-  [255]
+  [10]
 
 note that percent encoding is not handled:
 
--- a/tests/test-commandserver.t	Fri Nov 19 15:40:56 2021 -0800
+++ b/tests/test-commandserver.t	Fri Nov 19 16:16:21 2021 -0800
@@ -159,7 +159,7 @@
   ...                         b'default'])
   *** runcommand log -b --config=alias.log=!echo pwned default
   abort: unknown revision '--config=alias.log=!echo pwned'
-   [255]
+   [10]
 
 check that "histedit --commands=-" can read rules from the input channel:
 
--- a/tests/test-dispatch.t	Fri Nov 19 15:40:56 2021 -0800
+++ b/tests/test-dispatch.t	Fri Nov 19 16:16:21 2021 -0800
@@ -127,20 +127,20 @@
 #if no-chg
   $ HGPLAIN=+strictflags hg log -b --config='hooks.pre-log=false' default
   abort: unknown revision '--config=hooks.pre-log=false'
-  [255]
+  [10]
   $ HGPLAIN=+strictflags hg log -b -R. default
   abort: unknown revision '-R.'
-  [255]
+  [10]
   $ HGPLAIN=+strictflags hg log -b --cwd=. default
   abort: unknown revision '--cwd=.'
-  [255]
+  [10]
 #endif
   $ HGPLAIN=+strictflags hg log -b --debugger default
   abort: unknown revision '--debugger'
-  [255]
+  [10]
   $ HGPLAIN=+strictflags hg log -b --config='alias.log=!echo pwned' default
   abort: unknown revision '--config=alias.log=!echo pwned'
-  [255]
+  [10]
 
   $ HGPLAIN=+strictflags hg log --config='hooks.pre-log=false' -b default
   abort: option --config may not be abbreviated
--- a/tests/test-infinitepush-ci.t	Fri Nov 19 15:40:56 2021 -0800
+++ b/tests/test-infinitepush-ci.t	Fri Nov 19 16:16:21 2021 -0800
@@ -204,7 +204,7 @@
   $ hg pull -r b4e4bce660512ad3e71189e14588a70ac8e31fef
   pulling from $TESTTMP/repo
   abort: unknown revision 'b4e4bce660512ad3e71189e14588a70ac8e31fef'
-  [255]
+  [10]
   $ hg glog
   o  1:6cb0989601f1 added a
   |  public
--- a/tests/test-log-bookmark.t	Fri Nov 19 15:40:56 2021 -0800
+++ b/tests/test-log-bookmark.t	Fri Nov 19 16:16:21 2021 -0800
@@ -189,10 +189,10 @@
 
   $ hg log -B unknown
   abort: bookmark 'unknown' does not exist
-  [255]
+  [10]
 
 Shouldn't accept string-matcher syntax:
 
   $ hg log -B 're:.*'
   abort: bookmark 're:.*' does not exist
-  [255]
+  [10]
--- a/tests/test-log.t	Fri Nov 19 15:40:56 2021 -0800
+++ b/tests/test-log.t	Fri Nov 19 16:16:21 2021 -0800
@@ -1417,7 +1417,7 @@
 
   $ hg log -b 're:.*'
   abort: unknown revision 're:.*'
-  [255]
+  [10]
   $ hg log -k 're:.*'
   $ hg log -u 're:.*'
 
@@ -1544,7 +1544,7 @@
 
   $ hg log -b dummy
   abort: unknown revision 'dummy'
-  [255]
+  [10]
 
 
 log -b .
--- a/tests/test-obsolete-distributed.t	Fri Nov 19 15:40:56 2021 -0800
+++ b/tests/test-obsolete-distributed.t	Fri Nov 19 16:16:21 2021 -0800
@@ -570,7 +570,7 @@
   added 2 changesets with 0 changes to 2 files (+1 heads)
   (2 other changesets obsolete on arrival)
   abort: cannot update to target: filtered revision '6'
-  [255]
+  [10]
 
   $ cd ..
 
--- a/tests/test-pull-r.t	Fri Nov 19 15:40:56 2021 -0800
+++ b/tests/test-pull-r.t	Fri Nov 19 16:16:21 2021 -0800
@@ -112,7 +112,7 @@
 
   $ hg pull -qr missing ../repo
   abort: unknown revision 'missing'
-  [255]
+  [10]
 
 Pull multiple revisions with update:
 
--- a/tests/test-remotefilelog-repack.t	Fri Nov 19 15:40:56 2021 -0800
+++ b/tests/test-remotefilelog-repack.t	Fri Nov 19 16:16:21 2021 -0800
@@ -307,7 +307,7 @@
   1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob)
   $ hg prefetch -r 38
   abort: unknown revision '38'
-  [255]
+  [10]
   $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack
   -r--r--r--      70 052643fdcdebbd42d7c180a651a30d46098e6fe1.datapack
   $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack
--- a/tests/test-revset.t	Fri Nov 19 15:40:56 2021 -0800
+++ b/tests/test-revset.t	Fri Nov 19 16:16:21 2021 -0800
@@ -306,7 +306,7 @@
     (negate
       (symbol 'a')))
   abort: unknown revision '-a'
-  [255]
+  [10]
   $ try é
   (symbol '\xc3\xa9')
   * set:
--- a/tests/test-revset2.t	Fri Nov 19 15:40:56 2021 -0800
+++ b/tests/test-revset2.t	Fri Nov 19 16:16:21 2021 -0800
@@ -870,7 +870,7 @@
   $ try m
   (symbol 'm')
   abort: unknown revision 'm'
-  [255]
+  [10]
 
   $ HGPLAINEXCEPT=revsetalias
   $ export HGPLAINEXCEPT
@@ -1061,7 +1061,7 @@
       (symbol 'max')
       (string '$1')))
   abort: unknown revision '$1'
-  [255]
+  [10]
 
 test scope of alias expansion: 'universe' is expanded prior to 'shadowall(0)',
 but 'all()' should never be substituted to '0()'.
--- a/tests/test-static-http.t	Fri Nov 19 15:40:56 2021 -0800
+++ b/tests/test-static-http.t	Fri Nov 19 16:16:21 2021 -0800
@@ -95,7 +95,7 @@
   $ cd ..
   $ hg clone -r doesnotexist static-http://localhost:$HGPORT/remote local0
   abort: unknown revision 'doesnotexist'
-  [255]
+  [10]
   $ hg clone -r 0 static-http://localhost:$HGPORT/remote local0
   adding changesets
   adding manifests
--- a/tests/test-template-functions.t	Fri Nov 19 15:40:56 2021 -0800
+++ b/tests/test-template-functions.t	Fri Nov 19 16:16:21 2021 -0800
@@ -1295,10 +1295,10 @@
   -1
   $ hg log -T '{revset("%d", rev + 1)}\n' -r'tip'
   abort: unknown revision '3'
-  [255]
+  [10]
   $ hg log -T '{revset("%d", rev - 1)}\n' -r'null'
   abort: unknown revision '-2'
-  [255]
+  [10]
 
 Invalid arguments passed to revset()