Mercurial > hg
changeset 14285:aa64a87b493d
help: give hint about 'hg help -e' when appropriate
The hint is only given if a command shadows an extension with the same
name and when that extension has a multi-line module docstring.
author | Martin Geisler <mg@aragost.com> |
---|---|
date | Tue, 10 May 2011 13:19:05 +0200 |
parents | 1f9e11f65cd7 |
children | 005a540e9aee |
files | mercurial/commands.py tests/test-extension.t |
diffstat | 2 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Wed Jan 20 20:24:20 2010 +0200 +++ b/mercurial/commands.py Tue May 10 13:19:05 2011 +0200 @@ -2223,6 +2223,18 @@ addglobalopts(False) + # check if this command shadows a non-trivial (multi-line) + # extension help text + try: + mod = extensions.find(name) + doc = gettext(mod.__doc__) or '' + if '\n' in doc.strip(): + msg = _('use "hg help -e %s" to show help for ' + 'the %s extension') % (name, name) + ui.write('\n%s\n' % msg) + except KeyError: + pass + def helplist(header, select=None): h = {} cmds = {}
--- a/tests/test-extension.t Wed Jan 20 20:24:20 2010 +0200 +++ b/tests/test-extension.t Tue May 10 13:19:05 2011 +0200 @@ -254,6 +254,8 @@ compared to the working directory, and, when no revisions are specified, the working directory files are compared to its parent. + use "hg help -e extdiff" to show help for the extdiff extension + options: -p --program CMD comparison program to run