[PATCH] fix for bug4240

Augie Fackler raf at durin42.com
Tue Jun 24 13:51:07 CDT 2014


On Tue, Jun 24, 2014 at 03:09:12PM +0530, Prabhu GS wrote:
> Hi all,
>
> After hg 3.0, "hg showconfig --help" was showing the configuration man page
> instead
> of the expected help page. I have fixed this regression by the below patch.
> Please let me know your views.

Please take a look at the checklist here
http://mercurial.selenic.com/wiki/ContributingChanges, especially
points 1, 2, 5 (the above text should be in the commit message) and
maybe 6.


>
>
>
> # HG changeset patch
> # User Prabhu Gnana Sundar <pprabhugs at gmail.com>
> # Date 1403602215 -19800
> #      Tue Jun 24 15:00:15 2014 +0530
> # Node ID 128bef6940f0eeb567b9b006178d2ecdce785904
> # Parent  99db956b88ab699644c99095fecadbc4c83adbfc
> fix: hg showconfig --help should show command help (bug4240)

better topic might be "dispatch: fix so that --help more reliably shows command help (issue4240)"

And then explain the failure mode here (that is, you see 'hg help
config' output and not 'hg help -c showconfig' output).

>
> This patch fixes the 'showconfig --help' regression issue.
> This patch removes an unwanted assignement of aliases[0] to cmd and
> shows the correct command in the first line of help description.
>
> diff -r 99db956b88ab -r 128bef6940f0 mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py      Sun Jun 01 16:01:01 2014 -0700
> +++ b/mercurial/cmdutil.py      Tue Jun 24 15:00:15 2014 +0530
> @@ -44,6 +44,8 @@
>                      found = a
>                      break
>          if found is not None:
> +            aliases = [x for x in aliases if x != cmd]
> +            aliases.insert(0, cmd)
>              if aliases[0].startswith("debug") or found.startswith("debug"):
>                  debugchoice[found] = (aliases, table[e])
>              else:
> diff -r 99db956b88ab -r 128bef6940f0 mercurial/dispatch.py
> --- a/mercurial/dispatch.py     Sun Jun 01 16:01:01 2014 -0700
> +++ b/mercurial/dispatch.py     Tue Jun 24 15:00:15 2014 +0530
> @@ -494,7 +494,6 @@
>          cmd, args = args[0], args[1:]
>          aliases, entry = cmdutil.findcmd(cmd, commands.table,
>                                           ui.configbool("ui", "strict"))
> -        cmd = aliases[0]
>          args = aliasargs(entry[0], args)
>          defaults = ui.config("defaults", cmd)
>          if defaults:
>
>
>
> This is my first patch to hg. I am also attaching the patch, just in case
> needed.

Shouldn't be needed, especially if you use the patchbomb extension as
suggested by the checklist.

>
> Thanks and regards
> Prabhu

> # HG changeset patch
> # User Prabhu Gnana Sundar <pprabhugs at gmail.com>
> # Date 1403602215 -19800
> #      Tue Jun 24 15:00:15 2014 +0530
> # Node ID 128bef6940f0eeb567b9b006178d2ecdce785904
> # Parent  99db956b88ab699644c99095fecadbc4c83adbfc
> fix: hg showconfig --help should show command help (bug4240)
>
> This patch fixes the 'showconfig --help' regression issue.
> This patch removes an unwanted assignement of aliases[0] to cmd and
> shows the correct command in the first line of help description.
>
> diff -r 99db956b88ab -r 128bef6940f0 mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py	Sun Jun 01 16:01:01 2014 -0700
> +++ b/mercurial/cmdutil.py	Tue Jun 24 15:00:15 2014 +0530
> @@ -44,6 +44,8 @@
>                      found = a
>                      break
>          if found is not None:
> +            aliases = [x for x in aliases if x != cmd]
> +            aliases.insert(0, cmd)
>              if aliases[0].startswith("debug") or found.startswith("debug"):
>                  debugchoice[found] = (aliases, table[e])
>              else:
> diff -r 99db956b88ab -r 128bef6940f0 mercurial/dispatch.py
> --- a/mercurial/dispatch.py	Sun Jun 01 16:01:01 2014 -0700
> +++ b/mercurial/dispatch.py	Tue Jun 24 15:00:15 2014 +0530
> @@ -494,7 +494,6 @@
>          cmd, args = args[0], args[1:]
>          aliases, entry = cmdutil.findcmd(cmd, commands.table,
>                                           ui.configbool("ui", "strict"))
> -        cmd = aliases[0]
>          args = aliasargs(entry[0], args)
>          defaults = ui.config("defaults", cmd)
>          if defaults:

> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list