[Updated] D9165: errors: name arguments to AmbiguousCommand constructor
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Fri Oct 9 10:16:36 UTC 2020
Closed by commit rHG65e2b64670b5: errors: name arguments to AmbiguousCommand 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/D9165?vs=23070&id=23145
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D9165/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D9165
AFFECTED FILES
mercurial/dispatch.py
mercurial/error.py
mercurial/help.py
CHANGE DETAILS
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -713,7 +713,7 @@
except error.AmbiguousCommand as inst:
# py3 fix: except vars can't be used outside the scope of the
# except block, nor can be used inside a lambda. python issue4617
- prefix = inst.args[0]
+ prefix = inst.prefix
select = lambda c: cmdutil.parsealiases(c)[0].startswith(prefix)
rst = helplist(select)
return rst
diff --git a/mercurial/error.py b/mercurial/error.py
--- a/mercurial/error.py
+++ b/mercurial/error.py
@@ -117,6 +117,11 @@
class AmbiguousCommand(Exception):
"""Exception raised if command shortcut matches more than one command."""
+ def __init__(self, prefix, matches):
+ self.prefix = prefix
+ self.matches = matches
+ super(AmbiguousCommand, self).__init__()
+
__bytes__ = _tobytes
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -489,7 +489,7 @@
except error.AmbiguousCommand as inst:
ui.warn(
_(b"hg: command '%s' is ambiguous:\n %s\n")
- % (inst.args[0], b" ".join(inst.args[1]))
+ % (inst.prefix, b" ".join(inst.matches))
)
except error.CommandError as inst:
if inst.command:
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/7d2bed35/attachment-0002.html>
More information about the Mercurial-patches
mailing list