comparison mercurial/scmutil.py @ 45840:527ce85c2e60

errors: introduce StateError and use it from commands and cmdutil This very similar to an earlier patch (which was for `InputError`). In this patch, I also updated the transplant extension only because `test-transplant.t` would otherwise have needed a `#if continueflag`. Differential Revision: https://phab.mercurial-scm.org/D9310
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 12 Oct 2020 12:44:18 -0700
parents ebee234d952a
children bff719525815
comparison
equal deleted inserted replaced
45839:ebee234d952a 45840:527ce85c2e60
222 except error.WdirUnsupported: 222 except error.WdirUnsupported:
223 ui.error(_(b"abort: working directory revision cannot be specified\n")) 223 ui.error(_(b"abort: working directory revision cannot be specified\n"))
224 except error.Abort as inst: 224 except error.Abort as inst:
225 if isinstance(inst, error.InputError): 225 if isinstance(inst, error.InputError):
226 detailed_exit_code = 10 226 detailed_exit_code = 10
227 elif isinstance(inst, error.StateError):
228 detailed_exit_code = 20
227 ui.error(_(b"abort: %s\n") % inst.message) 229 ui.error(_(b"abort: %s\n") % inst.message)
228 if inst.hint: 230 if inst.hint:
229 ui.error(_(b"(%s)\n") % inst.hint) 231 ui.error(_(b"(%s)\n") % inst.hint)
230 except error.WorkerError as inst: 232 except error.WorkerError as inst:
231 # Don't print a message -- the worker already should have 233 # Don't print a message -- the worker already should have