# HG changeset patch # User Dan Villiom Podlaski Christiansen # Date 1247226025 -7200 # Node ID 98d90ad54749f3cc4dff597ffc30e10442a3fc86 # Parent 35c3f94233a0192fa143555f4dd3e60e3b997d67 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. diff -r 35c3f94233a0 -r 98d90ad54749 mercurial/commands.py --- 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() diff -r 35c3f94233a0 -r 98d90ad54749 tests/test-extension --- 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 diff -r 35c3f94233a0 -r 98d90ad54749 tests/test-extension.out --- 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: