comparison mercurial/scmutil.py @ 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 ae00e170f2d1
comparison
equal deleted inserted replaced
45827:8d72e29ad1e0 45828:e0dbfbd4062c
157 ui.traceback() 157 ui.traceback()
158 raise 158 raise
159 # Global exception handling, alphabetically 159 # Global exception handling, alphabetically
160 # Mercurial-specific first, followed by built-in and library exceptions 160 # Mercurial-specific first, followed by built-in and library exceptions
161 except error.LockHeld as inst: 161 except error.LockHeld as inst:
162 detailed_exit_code = 20
162 if inst.errno == errno.ETIMEDOUT: 163 if inst.errno == errno.ETIMEDOUT:
163 reason = _(b'timed out waiting for lock held by %r') % ( 164 reason = _(b'timed out waiting for lock held by %r') % (
164 pycompat.bytestr(inst.locker) 165 pycompat.bytestr(inst.locker)
165 ) 166 )
166 else: 167 else:
170 % (inst.desc or stringutil.forcebytestr(inst.filename), reason) 171 % (inst.desc or stringutil.forcebytestr(inst.filename), reason)
171 ) 172 )
172 if not inst.locker: 173 if not inst.locker:
173 ui.error(_(b"(lock might be very busy)\n")) 174 ui.error(_(b"(lock might be very busy)\n"))
174 except error.LockUnavailable as inst: 175 except error.LockUnavailable as inst:
176 detailed_exit_code = 20
175 ui.error( 177 ui.error(
176 _(b"abort: could not lock %s: %s\n") 178 _(b"abort: could not lock %s: %s\n")
177 % ( 179 % (
178 inst.desc or stringutil.forcebytestr(inst.filename), 180 inst.desc or stringutil.forcebytestr(inst.filename),
179 encoding.strtolocal(inst.strerror), 181 encoding.strtolocal(inst.strerror),