[PATCH] fix for bug4240

Prabhu GS pprabhugs at gmail.com
Tue Jun 24 04:39:12 CDT 2014


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.



# 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:



This is my first patch to hg. I am also attaching the patch, just in case
needed.

Thanks and regards
Prabhu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20140624/30396463/attachment.html>
-------------- next part --------------
# 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:


More information about the Mercurial-devel mailing list