changeset 40394:1feb4b2c8e40

commands: restore compatibility for "^cmd" registration (issue6005) This is done at loading time, where ui is available.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 18 Oct 2018 21:14:22 +0900
parents 229d23cdb203
children aca727359ec5
files mercurial/commands.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Oct 19 12:30:49 2018 +0200
+++ b/mercurial/commands.py	Thu Oct 18 21:14:22 2018 +0900
@@ -6139,6 +6139,16 @@
 def loadcmdtable(ui, name, cmdtable):
     """Load command functions from specified cmdtable
     """
+    cmdtable = cmdtable.copy()
+    for cmd in list(cmdtable):
+        if not cmd.startswith('^'):
+            continue
+        ui.deprecwarn("old-style command registration '%s' in extension '%s'"
+                      % (cmd, name), '4.8')
+        entry = cmdtable.pop(cmd)
+        entry[0].helpbasic = True
+        cmdtable[cmd[1:]] = entry
+
     overrides = [cmd for cmd in cmdtable if cmd in table]
     if overrides:
         ui.warn(_("extension '%s' overrides commands: %s\n")