diff --git a/mercurial/help.py b/mercurial/help.py --- a/mercurial/help.py +++ b/mercurial/help.py @@ -236,10 +236,12 @@ def help_(ui, name, unknowncmd=False, fu # 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 diff --git a/tests/test-alias.t b/tests/test-alias.t --- a/tests/test-alias.t +++ b/tests/test-alias.t @@ -98,6 +98,7 @@ disabled [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 @@ invalid options 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 @@ invalid options 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]