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.
--- 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