Mercurial > hg
changeset 9128:98d90ad54749
commands: hide deprecated commands.
A command is considered deprecated if the word "DEPRECATED" is found
in the doc string. Such commands are hidden from non-verbose help.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Fri, 10 Jul 2009 13:40:25 +0200 |
parents | 35c3f94233a0 |
children | 395b0e132836 |
files | mercurial/commands.py tests/test-extension tests/test-extension.out |
diffstat | 3 files changed, 51 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Sun Jul 12 07:56:43 2009 +0200 +++ b/mercurial/commands.py Fri Jul 10 13:40:25 2009 +0200 @@ -1493,7 +1493,10 @@ 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()
--- a/tests/test-extension Sun Jul 12 07:56:43 2009 +0200 +++ b/tests/test-extension Fri Jul 10 13:40:25 2009 +0200 @@ -73,11 +73,25 @@ "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
--- a/tests/test-extension.out Sun Jul 12 07:56:43 2009 +0200 +++ b/tests/test-extension.out Fri Jul 10 13:40:25 2009 +0200 @@ -19,15 +19,47 @@ 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: