errors: set detailed exit code to 100 for some remote errors
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 22 Oct 2020 13:31:34 -0700
changeset 45839 ebee234d952a
parent 45838 ae00e170f2d1
child 45840 527ce85c2e60
errors: set detailed exit code to 100 for some remote errors This is per https://www.mercurial-scm.org/wiki/ErrorCategoriesPlan. Differential Revision: https://phab.mercurial-scm.org/D9309
mercurial/scmutil.py
tests/test-bad-pull.t
tests/test-bundle2-exchange.t
tests/test-clone.t
tests/test-extdata.t
tests/test-http-bad-server.t
tests/test-http-bundle1.t
tests/test-http-permissions.t
tests/test-http-proxy.t
tests/test-http.t
tests/test-https.t
tests/test-largefiles-wireproto.t
tests/test-push-http.t
tests/test-serve.t
tests/test-static-http.t
tests/test-subrepo-deep-nested-change.t
tests/test-subrepo-relative-path.t
--- a/mercurial/scmutil.py	Thu Nov 12 21:56:52 2020 -0800
+++ b/mercurial/scmutil.py	Thu Oct 22 13:31:34 2020 -0700
@@ -182,6 +182,7 @@
             )
         )
     except error.OutOfBandError as inst:
+        detailed_exit_code = 100
         if inst.args:
             msg = _(b"abort: remote error:\n")
         else:
@@ -237,8 +238,10 @@
         elif m in b"zlib".split():
             ui.error(_(b"(is your Python install correct?)\n"))
     except util.urlerr.httperror as inst:
+        detailed_exit_code = 100
         ui.error(_(b"abort: %s\n") % stringutil.forcebytestr(inst))
     except util.urlerr.urlerror as inst:
+        detailed_exit_code = 100
         try:  # usually it is in the form (errno, strerror)
             reason = inst.reason.args[1]
         except (AttributeError, IndexError):
--- a/tests/test-bad-pull.t	Thu Nov 12 21:56:52 2020 -0800
+++ b/tests/test-bad-pull.t	Thu Oct 22 13:31:34 2020 -0700
@@ -2,7 +2,7 @@
 
   $ hg clone http://localhost:$HGPORT/ copy
   abort: * (glob)
-  [255]
+  [100]
 
   $ test -d copy
   [1]
@@ -11,5 +11,5 @@
   $ cat dumb.pid >> $DAEMON_PIDS
   $ hg clone http://localhost:$HGPORT/foo copy2
   abort: HTTP Error 404: * (glob)
-  [255]
+  [100]
   $ killdaemons.py
--- a/tests/test-bundle2-exchange.t	Thu Nov 12 21:56:52 2020 -0800
+++ b/tests/test-bundle2-exchange.t	Thu Oct 22 13:31:34 2020 -0700
@@ -987,7 +987,7 @@
   abort: remote error:
   incompatible Mercurial client; bundle2 required
   (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
-  [255]
+  [100]
   $ killdaemons.py
   $ cd ..
 
@@ -1032,7 +1032,7 @@
   abort: remote error:
   incompatible Mercurial client; bundle2 required
   (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
-  [255]
+  [100]
 
   $ killdaemons.py
 
@@ -1050,7 +1050,7 @@
   abort: remote error:
   incompatible Mercurial client; bundle2 required
   (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
-  [255]
+  [100]
   $ killdaemons.py
 
   $ hg --config devel.legacy.exchange=bundle1 clone ssh://user@dummy/bundle2onlyserver not-bundle2-ssh
@@ -1075,7 +1075,7 @@
   abort: remote error:
   incompatible Mercurial client; bundle2 required
   (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
-  [255]
+  [100]
 
   $ killdaemons.py
 
@@ -1132,7 +1132,7 @@
   abort: remote error:
   incompatible Mercurial client; bundle2 required
   (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
-  [255]
+  [100]
 
 (also check with ssh)
 
--- a/tests/test-clone.t	Thu Nov 12 21:56:52 2020 -0800
+++ b/tests/test-clone.t	Thu Oct 22 13:31:34 2020 -0700
@@ -618,7 +618,7 @@
 
   $ hg clone http://invalid:url/a b
   abort: error: nonnumeric port: 'url'
-  [255]
+  [100]
 
 No remote source
 
@@ -629,7 +629,7 @@
 #else
   $ hg clone http://$LOCALIP:3121/a b
   abort: error: *refused* (glob)
-  [255]
+  [100]
 #endif
   $ rm -rf b # work around bug with http clone
 
--- a/tests/test-extdata.t	Thu Nov 12 21:56:52 2020 -0800
+++ b/tests/test-extdata.t	Thu Oct 22 13:31:34 2020 -0700
@@ -113,7 +113,7 @@
   $ cd sub
   $ hg log -qr "extdata(filedata)"
   abort: error: $ENOENT$
-  [255]
+  [100]
   $ hg log -qr "extdata(shelldata)"
   2:f6ed99a58333
 
--- a/tests/test-http-bad-server.t	Thu Nov 12 21:56:52 2020 -0800
+++ b/tests/test-http-bad-server.t	Thu Oct 22 13:31:34 2020 -0700
@@ -41,7 +41,7 @@
 
   $ hg clone http://localhost:$HGPORT/ clone
   abort: error: (\$ECONNRESET\$|\$EADDRNOTAVAIL\$) (re)
-  [255]
+  [100]
 
 (The server exits on its own, but there is a race between that and starting a new server.
 So ensure the process is dead.)
@@ -63,7 +63,7 @@
 --runs-per-test=20 on macOS 10.12 during the freeze for 4.2.
   $ hg clone http://localhost:$HGPORT/ clone
   abort: error: * (glob)
-  [255]
+  [100]
 
   $ killdaemons.py $DAEMON_PIDS
 
@@ -74,7 +74,7 @@
 
   $ hg clone http://localhost:$HGPORT/ clone
   abort: error: bad HTTP status line: * (glob)
-  [255]
+  [100]
 
   $ killdaemons.py $DAEMON_PIDS
 
@@ -90,7 +90,7 @@
   $ cat hg.pid > $DAEMON_PIDS
   $ hg clone http://localhost:$HGPORT/ clone
   abort: error: bad HTTP status line: * (glob)
-  [255]
+  [100]
 
   $ killdaemons.py $DAEMON_PIDS
 
@@ -107,7 +107,7 @@
   $ cat hg.pid > $DAEMON_PIDS
   $ hg clone http://localhost:$HGPORT/ clone
   abort: error: bad HTTP status line: * (glob)
-  [255]
+  [100]
 
   $ killdaemons.py $DAEMON_PIDS
 
@@ -150,7 +150,7 @@
   $ hg clone http://localhost:$HGPORT/ clone
   requesting all changes
   abort: error: bad HTTP status line: * (glob)
-  [255]
+  [100]
 
   $ killdaemons.py $DAEMON_PIDS
 
@@ -217,7 +217,7 @@
 
   $ hg clone http://localhost:$HGPORT/ clone
   abort: error: bad HTTP status line: * (glob)
-  [255]
+  [100]
 
   $ killdaemons.py $DAEMON_PIDS
 
@@ -277,7 +277,7 @@
 
   $ hg clone http://localhost:$HGPORT/ clone
   abort: error: bad HTTP status line: H
-  [255]
+  [100]
 
   $ killdaemons.py $DAEMON_PIDS
 
--- a/tests/test-http-bundle1.t	Thu Nov 12 21:56:52 2020 -0800
+++ b/tests/test-http-bundle1.t	Thu Oct 22 13:31:34 2020 -0700
@@ -178,7 +178,7 @@
 
   $ hg clone http://localhost:$HGPORT/bad
   abort: HTTP Error 404: Not Found
-  [255]
+  [100]
 
 test http authentication
 + use the same server to test server side streaming preference
@@ -250,7 +250,7 @@
   [255]
   $ hg id http://user:pass2@localhost:$HGPORT2/
   abort: HTTP Error 403: no
-  [255]
+  [100]
 
   $ hg -R dest-pull tag -r tip top
   $ hg -R dest-pull push http://user:pass@localhost:$HGPORT2/
@@ -338,7 +338,7 @@
   updating to branch default
   cloning subrepo sub from http://localhost:$HGPORT/sub
   abort: HTTP Error 404: Not Found
-  [255]
+  [100]
   $ hg clone http://localhost:$HGPORT/ slash-clone
   requesting all changes
   adding changesets
@@ -349,7 +349,7 @@
   updating to branch default
   cloning subrepo sub from http://localhost:$HGPORT/sub
   abort: HTTP Error 404: Not Found
-  [255]
+  [100]
 
 check error log
 
@@ -364,7 +364,7 @@
   requesting all changes
   abort: remote error:
   this is an exercise
-  [255]
+  [100]
   $ cat error.log
 
 disable pull-based clones
@@ -375,7 +375,7 @@
   requesting all changes
   abort: remote error:
   server has pull-based clones disabled
-  [255]
+  [100]
 
 #if no-reposimplestore
 ... but keep stream clones working
--- a/tests/test-http-permissions.t	Thu Nov 12 21:56:52 2020 -0800
+++ b/tests/test-http-permissions.t	Thu Oct 22 13:31:34 2020 -0700
@@ -874,13 +874,13 @@
   searching for changes
   no changes found
   abort: HTTP Error 403: ssl required
-  [255]
+  [100]
 
   $ hg --cwd ../test2 push http://localhost:$HGPORT/
   pushing to http://localhost:$HGPORT/
   searching for changes
   abort: HTTP Error 403: ssl required
-  [255]
+  [100]
 
   $ killdaemons.py
 
--- a/tests/test-http-proxy.t	Thu Nov 12 21:56:52 2020 -0800
+++ b/tests/test-http-proxy.t	Thu Oct 22 13:31:34 2020 -0700
@@ -91,7 +91,7 @@
 
   $ http_proxy=localhost:$HGPORT2 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ f
   abort: error: (Connection refused|Protocol not supported|.* actively refused it|\$EADDRNOTAVAIL\$|No route to host) (re)
-  [255]
+  [100]
 
 do not use the proxy if it is in the no list
 
--- a/tests/test-http.t	Thu Nov 12 21:56:52 2020 -0800
+++ b/tests/test-http.t	Thu Oct 22 13:31:34 2020 -0700
@@ -167,7 +167,7 @@
 
   $ hg clone http://localhost:$HGPORT/bad
   abort: HTTP Error 404: Not Found
-  [255]
+  [100]
 
 test http authentication
 + use the same server to test server side streaming preference
@@ -283,7 +283,7 @@
   [255]
   $ hg id http://user:pass2@localhost:$HGPORT2/
   abort: HTTP Error 403: no
-  [255]
+  [100]
 
   $ hg -R dest-pull tag -r tip top
   $ hg -R dest-pull push http://user:pass@localhost:$HGPORT2/
@@ -475,7 +475,7 @@
   updating to branch default
   cloning subrepo sub from http://localhost:$HGPORT/sub
   abort: HTTP Error 404: Not Found
-  [255]
+  [100]
   $ hg clone http://localhost:$HGPORT/ slash-clone
   requesting all changes
   adding changesets
@@ -486,7 +486,7 @@
   updating to branch default
   cloning subrepo sub from http://localhost:$HGPORT/sub
   abort: HTTP Error 404: Not Found
-  [255]
+  [100]
 
 check error log
 
@@ -588,7 +588,7 @@
 
   $ hg id http://localhost:$HGPORT
   abort: HTTP Error 500: no-cookie
-  [255]
+  [100]
 
 Populate a cookies file
 
@@ -602,7 +602,7 @@
 
   $ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/
   abort: HTTP Error 500: no-cookie
-  [255]
+  [100]
 
 Add a cookie entry for our test server and verify it is sent
 
@@ -612,4 +612,4 @@
 
   $ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/
   abort: HTTP Error 500: Cookie: hgkey=localhostvalue
-  [255]
+  [100]
--- a/tests/test-https.t	Thu Nov 12 21:56:52 2020 -0800
+++ b/tests/test-https.t	Thu Oct 22 13:31:34 2020 -0700
@@ -59,7 +59,7 @@
   $ hg clone https://localhost:$HGPORT/ copy-pull
   (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
   abort: error: *certificate verify failed* (glob)
-  [255]
+  [100]
 #endif
 
 Specifying a per-host certificate file that doesn't exist will abort.  The full
@@ -84,7 +84,7 @@
   (an attempt was made to load CA certificates but none were loaded; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error)
   (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
   abort: error: *certificate verify failed* (glob)
-  [255]
+  [100]
 
 A per-host certificate matching the server's cert will be accepted
 
@@ -238,7 +238,7 @@
   pulling from https://localhost:$HGPORT/
   (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
   abort: error: *certificate verify failed* (glob)
-  [255]
+  [100]
   $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub-other.pem" \
   > --insecure
   pulling from https://localhost:$HGPORT/
@@ -255,7 +255,7 @@
   pulling from https://localhost:$HGPORT1/
   (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
   abort: error: *certificate verify failed* (glob)
-  [255]
+  [100]
 
 Test server cert which no longer is valid
 
@@ -266,7 +266,7 @@
   pulling from https://localhost:$HGPORT2/
   (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
   abort: error: *certificate verify failed* (glob)
-  [255]
+  [100]
 
 Setting ciphers to an invalid value aborts
   $ P="$CERTSDIR" hg --config hostsecurity.ciphers=invalid -R copy-pull id https://localhost:$HGPORT/
@@ -375,26 +375,26 @@
   (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
   (see https://mercurial-scm.org/wiki/SecureConnections for more info)
   abort: error: .*(unsupported protocol|wrong ssl version).* (re)
-  [255]
+  [100]
 
   $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.1 id https://localhost:$HGPORT/
   (could not negotiate a common security protocol (tls1.1+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
   (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
   (see https://mercurial-scm.org/wiki/SecureConnections for more info)
   abort: error: .*(unsupported protocol|wrong ssl version).* (re)
-  [255]
+  [100]
   $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.2 id https://localhost:$HGPORT/
   (could not negotiate a common security protocol (tls1.2+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
   (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
   (see https://mercurial-scm.org/wiki/SecureConnections for more info)
   abort: error: .*(unsupported protocol|wrong ssl version).* (re)
-  [255]
+  [100]
   $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.2 id https://localhost:$HGPORT1/
   (could not negotiate a common security protocol (tls1.2+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
   (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
   (see https://mercurial-scm.org/wiki/SecureConnections for more info)
   abort: error: .*(unsupported protocol|wrong ssl version).* (re)
-  [255]
+  [100]
 
 --insecure will allow TLS 1.0 connections and override configs
 
@@ -417,7 +417,7 @@
   (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
   (see https://mercurial-scm.org/wiki/SecureConnections for more info)
   abort: error: .*(unsupported protocol|wrong ssl version).* (re)
-  [255]
+  [100]
 
 .hg/hgrc file [hostsecurity] settings are applied to remote ui instances (issue5305)
 
@@ -430,7 +430,7 @@
   (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
   (see https://mercurial-scm.org/wiki/SecureConnections for more info)
   abort: error: .*(unsupported protocol|wrong ssl version).* (re)
-  [255]
+  [100]
 
   $ killdaemons.py hg0.pid
   $ killdaemons.py hg1.pid
@@ -482,13 +482,13 @@
   pulling from https://localhost:$HGPORT/
   (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
   abort: error: *certificate verify failed* (glob)
-  [255]
+  [100]
   $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull \
   > --config web.cacerts="$CERTSDIR/pub-expired.pem" https://localhost:$HGPORT2/
   pulling from https://localhost:$HGPORT2/
   (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
   abort: error: *certificate verify failed* (glob)
-  [255]
+  [100]
 
 
   $ killdaemons.py hg0.pid
@@ -518,7 +518,7 @@
 
   $ P="$CERTSDIR" hg id https://localhost:$HGPORT/
   abort: error: .*(\$ECONNRESET\$|certificate required|handshake failure).* (re)
-  [255]
+  [100]
 
 with client certificate:
 
@@ -539,7 +539,7 @@
 
   $ env P="$CERTSDIR" hg id https://localhost:$HGPORT/
   abort: error: * (glob)
-  [255]
+  [100]
 
 Missing certficate and key files result in error
 
--- a/tests/test-largefiles-wireproto.t	Thu Nov 12 21:56:52 2020 -0800
+++ b/tests/test-largefiles-wireproto.t	Thu Oct 22 13:31:34 2020 -0700
@@ -117,7 +117,7 @@
   This repository uses the largefiles extension.
   
   Please enable it in your Mercurial config file.
-  [255]
+  [100]
 
 used all HGPORTs, kill all daemons
   $ killdaemons.py
@@ -133,7 +133,7 @@
   remote: -
   abort: remote error
   (check previous remote output)
-  [255]
+  [100]
 
 #if serve
 
--- a/tests/test-push-http.t	Thu Nov 12 21:56:52 2020 -0800
+++ b/tests/test-push-http.t	Thu Oct 22 13:31:34 2020 -0700
@@ -41,7 +41,7 @@
   searching for changes
   abort: HTTP Error 403: ssl required
   % serve errors
-  [255]
+  [100]
 
 expect authorization error
 
--- a/tests/test-serve.t	Thu Nov 12 21:56:52 2020 -0800
+++ b/tests/test-serve.t	Thu Oct 22 13:31:34 2020 -0700
@@ -90,10 +90,10 @@
 
   $ hg id http://localhost:$HGPORT/some/dir7
   abort: HTTP Error 404: Not Found
-  [255]
+  [100]
   $ hg id http://localhost:$HGPORT/some
   abort: HTTP Error 404: Not Found
-  [255]
+  [100]
 
   $ cat access.log errors.log
   $LOCALIP - - [$LOGDATE$] "GET /some/dir7?cmd=capabilities HTTP/1.1" 404 - (glob)
--- a/tests/test-static-http.t	Thu Nov 12 21:56:52 2020 -0800
+++ b/tests/test-static-http.t	Thu Oct 22 13:31:34 2020 -0700
@@ -2,7 +2,7 @@
 
   $ hg clone http://localhost:$HGPORT/ copy
   abort: * (glob)
-  [255]
+  [100]
   $ test -d copy
   [1]
 
--- a/tests/test-subrepo-deep-nested-change.t	Thu Nov 12 21:56:52 2020 -0800
+++ b/tests/test-subrepo-deep-nested-change.t	Thu Oct 22 13:31:34 2020 -0700
@@ -110,7 +110,7 @@
   updating to branch default
   cloning subrepo sub1 from http://localhost:$HGPORT/../sub1
   abort: HTTP Error 404: Not Found
-  [255]
+  [100]
 
   $ cat access.log
   * "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
--- a/tests/test-subrepo-relative-path.t	Thu Nov 12 21:56:52 2020 -0800
+++ b/tests/test-subrepo-relative-path.t	Thu Oct 22 13:31:34 2020 -0700
@@ -85,7 +85,7 @@
   searching for changes
   no changes found
   abort: HTTP Error 403: ssl required
-  [255]
+  [100]
 
 Checking cloned repo ids