help: escape ':' (as '\:') when generating command names
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 25 Jan 2021 23:08:33 +0100
changeset 46386 d481f30ea8e3
parent 46385 aaff3bc75306
child 46387 c41ac8985fe4
help: escape ':' (as '\:') when generating command names We need this before we can use ":" in command names. Differential Revision: https://phab.mercurial-scm.org/D9870
mercurial/help.py
--- a/mercurial/help.py	Mon Jan 25 23:07:56 2021 +0100
+++ b/mercurial/help.py	Mon Jan 25 23:08:33 2021 +0100
@@ -829,10 +829,11 @@
         def appendcmds(cmds):
             cmds = sorted(cmds)
             for c in cmds:
+                display_cmd = c
                 if ui.verbose:
-                    rst.append(b" :%s: %s\n" % (b', '.join(syns[c]), h[c]))
-                else:
-                    rst.append(b' :%s: %s\n' % (c, h[c]))
+                    display_cmd = b', '.join(syns[c])
+                display_cmd = display_cmd.replace(b':', br'\:')
+                rst.append(b' :%s: %s\n' % (display_cmd, h[c]))
 
         if name in (b'shortlist', b'debug'):
             # List without categories.