[Updated] D9164: errors: name arguments to CommandError constructor
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Fri Oct 9 10:16:20 UTC 2020
Closed by commit rHGbd2df58366b1: errors: name arguments to CommandError constructor (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D9164?vs=23069&id=23144
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D9164/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D9164
AFFECTED FILES
mercurial/dispatch.py
mercurial/error.py
CHANGE DETAILS
diff --git a/mercurial/error.py b/mercurial/error.py
--- a/mercurial/error.py
+++ b/mercurial/error.py
@@ -100,6 +100,11 @@
class CommandError(Exception):
"""Exception raised on errors in parsing the command line."""
+ def __init__(self, command, message):
+ self.command = command
+ self.message = message
+ super(CommandError, self).__init__()
+
__bytes__ = _tobytes
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -492,13 +492,13 @@
% (inst.args[0], b" ".join(inst.args[1]))
)
except error.CommandError as inst:
- if inst.args[0]:
+ if inst.command:
ui.pager(b'help')
- msgbytes = pycompat.bytestr(inst.args[1])
- ui.warn(_(b"hg %s: %s\n") % (inst.args[0], msgbytes))
- commands.help_(ui, inst.args[0], full=False, command=True)
+ msgbytes = pycompat.bytestr(inst.message)
+ ui.warn(_(b"hg %s: %s\n") % (inst.command, msgbytes))
+ commands.help_(ui, inst.command, full=False, command=True)
else:
- ui.warn(_(b"hg: %s\n") % inst.args[1])
+ ui.warn(_(b"hg: %s\n") % inst.message)
ui.warn(_(b"(use 'hg help -v' for a list of global options)\n"))
except error.ParseError as inst:
_formatparse(ui.warn, inst)
To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20201009/33b4dc53/attachment-0002.html>
More information about the Mercurial-patches
mailing list