[PATCH] help: suggest '-v -e' to get list of built-in aliases for extensions (issue4461)
Augie Fackler
raf at durin42.com
Mon Dec 22 15:08:19 CST 2014
On Mon, Dec 22, 2014 at 03:49:45PM -0500, Augie Fackler wrote:
> On Mon, Dec 22, 2014 at 05:18:28AM +0100, Chingis Dugarzhapov wrote:
> > # HG changeset patch
> > # User Chingis Dugarzhapov <chingis.dug at gmail.com>
> > # Date 1419214850 -3600
> > # Mon Dec 22 03:20:50 2014 +0100
> > # Node ID f01ae4ba2a054656e71a315e2ad83027f3419a28
> > # Parent 7b8ff3fd11d39bd809fc65c628d65045502178cc
> > help: suggest '-v -e' to get list of built-in aliases for extensions (issue4461)
>
> Looks good, queued, thanks.
FYI, fixing the commit message in flight. The testsuite sends its regards.
>
> >
> > If extension name matches one of command names, suggest user to type
> > 'hg help -v -e <extension>' to get full list of built-in aliases
> >
> > diff -r 7b8ff3fd11d3 -r f01ae4ba2a05 mercurial/help.py
> > --- a/mercurial/help.py Wed Dec 17 13:25:24 2014 -0600
> > +++ b/mercurial/help.py Mon Dec 22 03:20:50 2014 +0100
> > @@ -371,6 +371,9 @@
> > elif name and not full:
> > rst.append(_('\n(use "hg help %s" to show the full help '
> > 'text)\n') % name)
> > + elif name and cmds and name in cmds.keys():
> > + rst.append(_('\n(use "hg help -v -e %s" to show built-in '
> > + 'aliases and global options)\n') % name)
> > else:
> > rst.append(_('\n(use "hg help -v%s" to show built-in aliases '
> > 'and global options)\n')
> > diff -r 7b8ff3fd11d3 -r f01ae4ba2a05 tests/test-extension.t
> > --- a/tests/test-extension.t Wed Dec 17 13:25:24 2014 -0600
> > +++ b/tests/test-extension.t Mon Dec 22 03:20:50 2014 +0100
> > @@ -462,7 +462,7 @@
> >
> > extdiff use external program to diff repository (or selected files)
> >
> > - (use "hg help -v extdiff" to show built-in aliases and global options)
> > + (use "hg help -v -e extdiff" to show built-in aliases and global options)
> >
> >
> >
> > @@ -573,6 +573,214 @@
> > strip
> > mq
> >
> > +For extensions, which name matches one of its commands, help
> > +message should ask '-v -e' to get list of built-in aliases
> > +along with extension help itself
> > +
> > + $ mkdir $TESTTMP/d
> > + $ cat > $TESTTMP/d/dodo.py <<EOF
> > + > """
> > + > This is an awesome 'dodo' extension. It does nothing and
> > + > writes 'Foo foo'
> > + > """
> > + > from mercurial import cmdutil, commands
> > + > cmdtable = {}
> > + > command = cmdutil.command(cmdtable)
> > + > @command('dodo', [], 'hg dodo')
> > + > def dodo(ui, *args, **kwargs):
> > + > """Does nothing"""
> > + > ui.write("I do nothing. Yay\\n")
> > + > @command('foofoo', [], 'hg foofoo')
> > + > def foofoo(ui, *args, **kwargs):
> > + > """Writes 'Foo foo'"""
> > + > ui.write("Foo foo\\n")
> > + > EOF
> > + $ dodopath=$TESTTMP/d/dodo.py
> > +
> > + $ echo "dodo = $dodopath" >> $HGRCPATH
> > +
> > +Make sure that user is asked to enter '-v -e' to get list of built-in aliases
> > + $ hg help -e dodo
> > + dodo extension -
> > +
> > + This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
> > +
> > + list of commands:
> > +
> > + dodo Does nothing
> > + foofoo Writes 'Foo foo'
> > +
> > + (use "hg help -v -e dodo" to show built-in aliases and global options)
> > +
> > +Make sure that '-v -e' prints list of built-in aliases along with
> > +extension help itself
> > + $ hg help -v -e dodo
> > + dodo extension -
> > +
> > + This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
> > +
> > + list of commands:
> > +
> > + dodo Does nothing
> > + foofoo Writes 'Foo foo'
> > +
> > + global options ([+] can be repeated):
> > +
> > + -R --repository REPO repository root directory or name of overlay bundle
> > + file
> > + --cwd DIR change working directory
> > + -y --noninteractive do not prompt, automatically pick the first choice for
> > + all prompts
> > + -q --quiet suppress output
> > + -v --verbose enable additional output
> > + --config CONFIG [+] set/override config option (use 'section.name=value')
> > + --debug enable debugging output
> > + --debugger start debugger
> > + --encoding ENCODE set the charset encoding (default: ascii)
> > + --encodingmode MODE set the charset encoding mode (default: strict)
> > + --traceback always print a 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
> > + --hidden consider hidden changesets
> > +
> > +Make sure that single '-v' option shows help and built-ins only for 'dodo' command
> > + $ hg help -v dodo
> > + hg dodo
> > +
> > + Does nothing
> > +
> > + (use "hg help -e dodo" to show help for the dodo extension)
> > +
> > + options:
> > +
> > + --mq operate on patch repository
> > +
> > + global options ([+] can be repeated):
> > +
> > + -R --repository REPO repository root directory or name of overlay bundle
> > + file
> > + --cwd DIR change working directory
> > + -y --noninteractive do not prompt, automatically pick the first choice for
> > + all prompts
> > + -q --quiet suppress output
> > + -v --verbose enable additional output
> > + --config CONFIG [+] set/override config option (use 'section.name=value')
> > + --debug enable debugging output
> > + --debugger start debugger
> > + --encoding ENCODE set the charset encoding (default: ascii)
> > + --encodingmode MODE set the charset encoding mode (default: strict)
> > + --traceback always print a 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
> > + --hidden consider hidden changesets
> > +
> > +In case when extension name doesn't match any of its commands,
> > +help message should ask for '-v' to get list of built-in aliases
> > +along with extension help
> > + $ cat > $TESTTMP/d/dudu.py <<EOF
> > + > """
> > + > This is an awesome 'dudu' extension. It does something and
> > + > also writes 'Beep beep'
> > + > """
> > + > from mercurial import cmdutil, commands
> > + > cmdtable = {}
> > + > command = cmdutil.command(cmdtable)
> > + > @command('something', [], 'hg something')
> > + > def something(ui, *args, **kwargs):
> > + > """Does something"""
> > + > ui.write("I do something. Yaaay\\n")
> > + > @command('beep', [], 'hg beep')
> > + > def beep(ui, *args, **kwargs):
> > + > """Writes 'Beep beep'"""
> > + > ui.write("Beep beep\\n")
> > + > EOF
> > + $ dudupath=$TESTTMP/d/dudu.py
> > +
> > + $ echo "dudu = $dudupath" >> $HGRCPATH
> > +
> > + $ hg help -e dudu
> > + dudu extension -
> > +
> > + This is an awesome 'dudu' extension. It does something and also writes 'Beep
> > + beep'
> > +
> > + list of commands:
> > +
> > + beep Writes 'Beep beep'
> > + something Does something
> > +
> > + (use "hg help -v dudu" to show built-in aliases and global options)
> > +
> > +In case when extension name doesn't match any of its commands,
> > +help options '-v' and '-v -e' should be equivalent
> > + $ hg help -v dudu
> > + dudu extension -
> > +
> > + This is an awesome 'dudu' extension. It does something and also writes 'Beep
> > + beep'
> > +
> > + list of commands:
> > +
> > + beep Writes 'Beep beep'
> > + something Does something
> > +
> > + global options ([+] can be repeated):
> > +
> > + -R --repository REPO repository root directory or name of overlay bundle
> > + file
> > + --cwd DIR change working directory
> > + -y --noninteractive do not prompt, automatically pick the first choice for
> > + all prompts
> > + -q --quiet suppress output
> > + -v --verbose enable additional output
> > + --config CONFIG [+] set/override config option (use 'section.name=value')
> > + --debug enable debugging output
> > + --debugger start debugger
> > + --encoding ENCODE set the charset encoding (default: ascii)
> > + --encodingmode MODE set the charset encoding mode (default: strict)
> > + --traceback always print a 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
> > + --hidden consider hidden changesets
> > +
> > + $ hg help -v -e dudu
> > + dudu extension -
> > +
> > + This is an awesome 'dudu' extension. It does something and also writes 'Beep
> > + beep'
> > +
> > + list of commands:
> > +
> > + beep Writes 'Beep beep'
> > + something Does something
> > +
> > + global options ([+] can be repeated):
> > +
> > + -R --repository REPO repository root directory or name of overlay bundle
> > + file
> > + --cwd DIR change working directory
> > + -y --noninteractive do not prompt, automatically pick the first choice for
> > + all prompts
> > + -q --quiet suppress output
> > + -v --verbose enable additional output
> > + --config CONFIG [+] set/override config option (use 'section.name=value')
> > + --debug enable debugging output
> > + --debugger start debugger
> > + --encoding ENCODE set the charset encoding (default: ascii)
> > + --encodingmode MODE set the charset encoding mode (default: strict)
> > + --traceback always print a 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
> > + --hidden consider hidden changesets
> > +
> > Disabled extension commands:
> >
> > $ ORGHGRCPATH=$HGRCPATH
> > _______________________________________________
> > Mercurial-devel mailing list
> > Mercurial-devel at selenic.com
> > http://selenic.com/mailman/listinfo/mercurial-devel
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list