diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1493,7 +1493,10 @@ def help_(ui, name=None, with_version=Fa f = f.lstrip("^") if not ui.debugflag and f.startswith("debug"): continue - doc = gettext(e[0].__doc__) + doc = e[0].__doc__ + if doc and 'DEPRECATED' in doc and not ui.verbose: + continue + doc = gettext(doc) if not doc: doc = _("(no help text available)") h[f] = doc.splitlines(0)[0].rstrip() diff --git a/tests/test-extension b/tests/test-extension --- a/tests/test-extension +++ b/tests/test-extension @@ -73,11 +73,25 @@ def debugfoobar(ui, repo, *args, **opts) "yet another debug command" pass -cmdtable = {"debugfoobar": (debugfoobar, (), "hg debugfoobar")} +def foo(ui, repo, *args, **opts): + """yet another foo command + + This command has been DEPRECATED since forever. + """ + pass + +cmdtable = { + "debugfoobar": (debugfoobar, (), "hg debugfoobar"), + "foo": (foo, (), "hg foo") +} EOF debugpath=`pwd`/debugextension.py echo "debugextension = $debugpath" >> $HGRCPATH +echo "% hg help" hg help debugextension +echo "% hg help --verbose" +hg --verbose help debugextension +echo "% hg help --debug" hg --debug help debugextension echo 'debugextension = !' >> $HGRCPATH diff --git a/tests/test-extension.out b/tests/test-extension.out --- a/tests/test-extension.out +++ b/tests/test-extension.out @@ -19,15 +19,47 @@ Foo empty extension - empty cmdtable no commands defined +% hg help debugextension extension - only debugcommands no commands defined +% hg help --verbose +debugextension extension - only debugcommands + +list of commands: + + foo: + yet another foo command + +enabled extensions: + + debugextension only debugcommands + +global options: + -R --repository repository root directory or symbolic path name + --cwd change working directory + -y --noninteractive do not prompt, assume 'yes' for any required answers + -q --quiet suppress output + -v --verbose enable additional output + --config set/override config option + --debug enable debugging output + --debugger start debugger + --encoding set the charset encoding (default: ascii) + --encodingmode set the charset encoding mode (default: strict) + --traceback print traceback on exception + --time time how long the command takes + --profile print command execution profile + --version output version information and exit + -h --help display help and exit +% hg help --debug debugextension extension - only debugcommands list of commands: debugfoobar: yet another debug command + foo: + yet another foo command enabled extensions: