commands: restore compatibility for "^cmd" registration (issue6005)
authorYuya Nishihara <yuya@tcha.org>
Thu, 18 Oct 2018 21:14:22 +0900
changeset 40394 1feb4b2c8e40
parent 40393 229d23cdb203
child 40395 aca727359ec5
commands: restore compatibility for "^cmd" registration (issue6005) This is done at loading time, where ui is available.
mercurial/commands.py
--- 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")