help: provide help of bad alias without executing aliascmd()
The output is slightly changed because of minirst formatting. Previously,
ui.pushbuffer() had no effect because "badalias" message was written to stderr.
"if not unknowncmd" should no longer be needed because there's no call loop.
--- a/mercurial/help.py Wed Aug 13 19:28:42 2014 +0900
+++ b/mercurial/help.py Wed Aug 13 19:38:47 2014 +0900
@@ -236,10 +236,12 @@
# check if it's an invalid alias and display its error if it is
if getattr(entry[0], 'badalias', None):
- if not unknowncmd:
- ui.pushbuffer()
- entry[0](ui)
- rst.append(ui.popbuffer())
+ rst.append(entry[0].badalias + '\n')
+ if entry[0].unknowncmd:
+ try:
+ rst.extend(helpextcmd(entry[0].cmdname))
+ except error.UnknownCommand:
+ pass
return rst
# synopsis
--- a/tests/test-alias.t Wed Aug 13 19:28:42 2014 +0900
+++ b/tests/test-alias.t Wed Aug 13 19:38:47 2014 +0900
@@ -98,6 +98,7 @@
[255]
$ hg help disabled
alias 'disabled' resolves to unknown command 'email'
+
'email' is provided by the following extension:
patchbomb command to send changesets as (a series of) patch emails
@@ -129,7 +130,8 @@
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
+ 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
[255]
@@ -139,12 +141,14 @@
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
+ 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
[255]
$ hg help no--repository
- error in definition for alias 'no--repository': --repository may only be given on the command line
+ 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
[255]