[PATCH] dispatch: fix so that --help more reliably shows command help (issue4240)

Prabhu GS pprabhugs at gmail.com
Fri Jul 25 01:50:00 CDT 2014


Hi,

Yeah, the issue was with aliases. Since "diff".startswith("di") there was
no problem with aliasing di and diff. But this failed because "commit" does
not startwith "ci".
All tests are passing.


cheers,
Prabhu


On Tue, Jul 22, 2014 at 9:07 PM, Prabhu Gnana Sundar <pprabhugs at gmail.com>
wrote:

> # HG changeset patch
> # User Prabhu Gnana Sundar <pprabhugs at gmail.com>
> # Date 1406011473 -19800
> #      Tue Jul 22 12:14:33 2014 +0530
> # Branch stable
> # Node ID f3157bfd4969cfec2c0f6577841feca6638823b7
> # Parent  a5168eb9b2bc488f42809872d22321a9825bc738
> dispatch: fix so that --help more reliably shows command help (issue4240)
>
> After hg 3.0, "hg showconfig --help" was showing the configuration man page
> instead of the 'hg help -c showconfig' output.
>
> This patch fixes the 'hg showconfig --help' regression issue by removing an
> unwanted assignement of aliases[0] to cmd and shows the correct command
> in the first line of help description.
> Also, added a test case to test 'hg showconfig --help'.
>
> diff -r a5168eb9b2bc -r f3157bfd4969 mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py      Mon Jul 21 11:27:24 2014 -0700
> +++ b/mercurial/cmdutil.py      Tue Jul 22 12:14:33 2014 +0530
> @@ -44,6 +44,9 @@
>                      found = a
>                      break
>          if found is not None:
> +            if found.find("config") != -1:
> +                aliases = [alias for alias in aliases if alias != cmd]
> +                aliases.insert(0, cmd)
>              if aliases[0].startswith("debug") or
> found.startswith("debug"):
>                  debugchoice[found] = (aliases, table[e])
>              else:
> diff -r a5168eb9b2bc -r f3157bfd4969 tests/test-help.t
> --- a/tests/test-help.t Mon Jul 21 11:27:24 2014 -0700
> +++ b/tests/test-help.t Tue Jul 22 12:14:33 2014 +0530
> @@ -2085,3 +2085,41 @@
>    $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
>
>  #endif
> +
> +
> +Test showconfig help
> +
> +  $ hg showconfig --help
> +  hg showconfig [-u] [NAME]...
> +
> +  aliases: config, debugconfig
> +
> +  show combined config settings from all hgrc files
> +
> +      With no arguments, print names and values of all config items.
> +
> +      With one argument of the form section.name, print just the value
> of that
> +      config item.
> +
> +      With multiple arguments, print names and values of all config items
> with
> +      matching section names.
> +
> +      With --edit, start an editor on the user-level config file. With
> --global,
> +      edit the system-wide config file. With --local, edit the
> repository-level
> +      config file.
> +
> +      With --debug, the source (filename and line number) is printed for
> each
> +      config item.
> +
> +      See "hg help config" for more information about config files.
> +
> +      Returns 0 on success.
> +
> +  options:
> +
> +   -u --untrusted show untrusted configuration options
> +   -e --edit      edit user config
> +   -l --local     edit repository config
> +   -g --global    edit global config
> +
> +  use "hg -v help showconfig" to show the global options
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20140725/8cd30e0f/attachment.html>


More information about the Mercurial-devel mailing list