changeset 45828:e0dbfbd4062c

errors: set detailed exit code to 20 for locking errors This is per https://www.mercurial-scm.org/wiki/ErrorCategoriesPlan. Differential Revision: https://phab.mercurial-scm.org/D9242
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 22 Oct 2020 13:38:14 -0700
parents 8d72e29ad1e0
children e7a4c018b563
files mercurial/scmutil.py tests/test-lock-badness.t tests/test-phases-exchange.t
diffstat 3 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Tue Oct 06 22:36:15 2020 -0700
+++ b/mercurial/scmutil.py	Thu Oct 22 13:38:14 2020 -0700
@@ -159,6 +159,7 @@
     # Global exception handling, alphabetically
     # Mercurial-specific first, followed by built-in and library exceptions
     except error.LockHeld as inst:
+        detailed_exit_code = 20
         if inst.errno == errno.ETIMEDOUT:
             reason = _(b'timed out waiting for lock held by %r') % (
                 pycompat.bytestr(inst.locker)
@@ -172,6 +173,7 @@
         if not inst.locker:
             ui.error(_(b"(lock might be very busy)\n"))
     except error.LockUnavailable as inst:
+        detailed_exit_code = 20
         ui.error(
             _(b"abort: could not lock %s: %s\n")
             % (
--- a/tests/test-lock-badness.t	Tue Oct 06 22:36:15 2020 -0700
+++ b/tests/test-lock-badness.t	Thu Oct 22 13:38:14 2020 -0700
@@ -136,6 +136,6 @@
   pushing to a
   searching for changes
   abort: could not lock repository a: Permission denied
-  [255]
+  [20]
 
   $ chmod 700 a/.hg/store
--- a/tests/test-phases-exchange.t	Tue Oct 06 22:36:15 2020 -0700
+++ b/tests/test-phases-exchange.t	Thu Oct 22 13:38:14 2020 -0700
@@ -1327,7 +1327,7 @@
   waiting for lock on repository $TESTTMP/Upsilon held by ''
   abort: repository $TESTTMP/Upsilon: timed out waiting for lock held by ''
   (lock might be very busy)
-  [255]
+  [20]
   $ rm .hg/store/lock
 
   $ cd ..