Patchwork D9870: help: escape ':' (as '\:') when generating command names

login
register
mail settings
Submitter phabricator
Date Jan. 26, 2021, 2:36 a.m.
Message ID <differential-rev-PHID-DREV-3cghpq2zjhb7xhve3w5m-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48179/
State Superseded
Headers show

Comments

phabricator - Jan. 26, 2021, 2:36 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We need this before we can use ":" in command names.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9870

AFFECTED FILES
  mercurial/help.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -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.