diff mercurial/dispatch.py @ 45678:bd2df58366b1

errors: name arguments to CommandError constructor Because readability counts. Differential Revision: https://phab.mercurial-scm.org/D9164
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 06 Oct 2020 20:37:35 -0700
parents 9b5723784aac
children 65e2b64670b5
line wrap: on
line diff
--- a/mercurial/dispatch.py	Tue Oct 06 21:52:27 2020 -0700
+++ b/mercurial/dispatch.py	Tue Oct 06 20:37:35 2020 -0700
@@ -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)