changeset 46458:d481f30ea8e3

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
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 25 Jan 2021 23:08:33 +0100
parents aaff3bc75306
children c41ac8985fe4
files mercurial/help.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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.