--- a/mercurial/dispatch.py Wed Aug 13 22:18:28 2014 +0900
+++ b/mercurial/dispatch.py Wed Aug 13 22:22:24 2014 +0900
@@ -443,16 +443,15 @@
def __call__(self, ui, *args, **opts):
if self.badalias:
- ui.warn(self.badalias + '\n')
+ hint = None
if self.unknowncmd:
try:
# check if the command is in a disabled extension
cmd, ext = extensions.disabledcmd(ui, self.cmdname)[:2]
- ui.warn(_("'%s' is provided by '%s' extension\n")
- % (cmd, ext))
+ hint = _("'%s' is provided by '%s' extension") % (cmd, ext)
except error.UnknownCommand:
pass
- return -1
+ raise util.Abort(self.badalias, hint=hint)
if self.shadows:
ui.debug("alias '%s' shadows command '%s'\n" %
(self.name, self.cmdname))
--- a/tests/test-alias.t Wed Aug 13 22:18:28 2014 +0900
+++ b/tests/test-alias.t Wed Aug 13 22:22:24 2014 +0900
@@ -62,7 +62,7 @@
unknown
$ hg unknown
- alias 'unknown' resolves to unknown command 'bargle'
+ abort: alias 'unknown' resolves to unknown command 'bargle'
[255]
$ hg help unknown
alias 'unknown' resolves to unknown command 'bargle'
@@ -71,7 +71,7 @@
ambiguous
$ hg ambiguous
- alias 'ambiguous' resolves to ambiguous command 's'
+ abort: alias 'ambiguous' resolves to ambiguous command 's'
[255]
$ hg help ambiguous
alias 'ambiguous' resolves to ambiguous command 's'
@@ -80,7 +80,7 @@
recursive
$ hg recursive
- alias 'recursive' resolves to unknown command 'recursive'
+ abort: alias 'recursive' resolves to unknown command 'recursive'
[255]
$ hg help recursive
alias 'recursive' resolves to unknown command 'recursive'
@@ -89,8 +89,8 @@
disabled
$ hg disabled
- alias 'disabled' resolves to unknown command 'email'
- 'email' is provided by 'patchbomb' extension
+ abort: alias 'disabled' resolves to unknown command 'email'
+ ('email' is provided by 'patchbomb' extension)
[255]
$ hg help disabled
alias 'disabled' resolves to unknown command 'email'
@@ -105,7 +105,7 @@
no definition
$ hg nodef
- no definition for alias 'nodefinition'
+ abort: no definition for alias 'nodefinition'
[255]
$ hg help nodef
no definition for alias 'nodefinition'
@@ -114,7 +114,7 @@
no closing quotation
$ hg noclosing
- error in definition for alias 'noclosingquotation': No closing quotation
+ abort: error in definition for alias 'noclosingquotation': No closing quotation
[255]
$ hg help noclosing
error in definition for alias 'noclosingquotation': No closing quotation
@@ -123,30 +123,30 @@
invalid options
$ hg no--cwd
- error in definition for alias 'no--cwd': --cwd may only be given on the command line
+ abort: error in definition for alias 'no--cwd': --cwd may only be given on the command line
[255]
$ hg help no--cwd
error in definition for alias 'no--cwd': --cwd may only be given on the
command line
$ hg no-R
- error in definition for alias 'no-R': -R may only be given on the command line
+ abort: error in definition for alias 'no-R': -R may only be given on the command line
[255]
$ hg help no-R
error in definition for alias 'no-R': -R may only be given on the command line
$ hg no--repo
- error in definition for alias 'no--repo': --repo may only be given on the command line
+ abort: error in definition for alias 'no--repo': --repo may only be given on the command line
[255]
$ hg help no--repo
error in definition for alias 'no--repo': --repo may only be given on the
command line
$ hg no--repository
- error in definition for alias 'no--repository': --repository may only be given on the command line
+ abort: error in definition for alias 'no--repository': --repository may only be given on the command line
[255]
$ hg help no--repository
error in definition for alias 'no--repository': --repository may only be given
on the command line
$ hg no--config
- error in definition for alias 'no--config': --config may only be given on the command line
+ abort: error in definition for alias 'no--config': --config may only be given on the command line
[255]
optional repository