D9384: errors: raise ConfigError on bad alias definition
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Tue Nov 24 18:07:37 UTC 2020
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D9384
AFFECTED FILES
mercurial/dispatch.py
tests/test-alias.t
CHANGE DETAILS
diff --git a/tests/test-alias.t b/tests/test-alias.t
--- a/tests/test-alias.t
+++ b/tests/test-alias.t
@@ -208,8 +208,8 @@
unknown
$ hg unknown
- abort: alias 'unknown' resolves to unknown command 'bargle'
- [255]
+ config error: alias 'unknown' resolves to unknown command 'bargle'
+ [30]
$ hg help unknown
alias 'unknown' resolves to unknown command 'bargle'
@@ -217,8 +217,8 @@
ambiguous
$ hg ambiguous
- abort: alias 'ambiguous' resolves to ambiguous command 's'
- [255]
+ config error: alias 'ambiguous' resolves to ambiguous command 's'
+ [30]
$ hg help ambiguous
alias 'ambiguous' resolves to ambiguous command 's'
@@ -226,8 +226,8 @@
recursive
$ hg recursive
- abort: alias 'recursive' resolves to unknown command 'recursive'
- [255]
+ config error: alias 'recursive' resolves to unknown command 'recursive'
+ [30]
$ hg help recursive
alias 'recursive' resolves to unknown command 'recursive'
@@ -235,9 +235,9 @@
disabled
$ hg disabled
- abort: alias 'disabled' resolves to unknown command 'email'
+ config error: alias 'disabled' resolves to unknown command 'email'
('email' is provided by 'patchbomb' extension)
- [255]
+ [30]
$ hg help disabled
alias 'disabled' resolves to unknown command 'email'
@@ -251,8 +251,8 @@
no definition
$ hg nodef
- abort: no definition for alias 'nodefinition'
- [255]
+ config error: no definition for alias 'nodefinition'
+ [30]
$ hg help nodef
no definition for alias 'nodefinition'
@@ -260,8 +260,8 @@
no closing quotation
$ hg noclosing
- abort: error in definition for alias 'noclosingquotation': No closing quotation
- [255]
+ config error: error in definition for alias 'noclosingquotation': No closing quotation
+ [30]
$ hg help noclosing
error in definition for alias 'noclosingquotation': No closing quotation
@@ -275,37 +275,37 @@
invalid options
$ hg no--cwd
- abort: error in definition for alias 'no--cwd': --cwd may only be given on the command line
- [255]
+ config error: error in definition for alias 'no--cwd': --cwd may only be given on the command line
+ [30]
$ hg help no--cwd
error in definition for alias 'no--cwd': --cwd may only be given on the
command line
$ hg no-R
- abort: error in definition for alias 'no-R': -R may only be given on the command line
- [255]
+ config error: error in definition for alias 'no-R': -R may only be given on the command line
+ [30]
$ hg help no-R
error in definition for alias 'no-R': -R may only be given on the command line
$ hg no--repo
- abort: error in definition for alias 'no--repo': --repo may only be given on the command line
- [255]
+ config error: error in definition for alias 'no--repo': --repo may only be given on the command line
+ [30]
$ hg help no--repo
error in definition for alias 'no--repo': --repo may only be given on the
command line
$ hg no--repository
- abort: error in definition for alias 'no--repository': --repository may only be given on the command line
- [255]
+ config error: error in definition for alias 'no--repository': --repository may only be given on the command line
+ [30]
$ hg help no--repository
error in definition for alias 'no--repository': --repository may only be given
on the command line
$ hg no--config
- abort: error in definition for alias 'no--config': --config may only be given on the command line
- [255]
+ config error: error in definition for alias 'no--config': --config may only be given on the command line
+ [30]
$ hg no --config alias.no='--repo elsewhere --cwd elsewhere status'
- abort: error in definition for alias 'no': --repo/--cwd may only be given on the command line
- [255]
+ config error: error in definition for alias 'no': --repo/--cwd may only be given on the command line
+ [30]
$ hg no --config alias.no='--repo elsewhere'
- abort: error in definition for alias 'no': --repo may only be given on the command line
- [255]
+ config error: error in definition for alias 'no': --repo may only be given on the command line
+ [30]
optional repository
@@ -631,11 +631,11 @@
$ hg help invalidhelp
non-ASCII character in alias definition 'invalidhelp:help'
$ hg invaliddoc
- abort: non-ASCII character in alias definition 'invaliddoc:doc'
- [255]
+ config error: non-ASCII character in alias definition 'invaliddoc:doc'
+ [30]
$ hg invalidhelp
- abort: non-ASCII character in alias definition 'invalidhelp:help'
- [255]
+ config error: non-ASCII character in alias definition 'invalidhelp:help'
+ [30]
invalid arguments
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -694,7 +694,7 @@
hint = _(b"'%s' is provided by '%s' extension") % (cmd, ext)
except error.UnknownCommand:
pass
- raise error.Abort(self.badalias, hint=hint)
+ raise error.ConfigError(self.badalias, hint=hint)
if self.shadows:
ui.debug(
b"alias '%s' shadows command '%s'\n" % (self.name, self.cmdname)
To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list