commands: restore compatibility for "^cmd" registration (
issue6005)
This is done at loading time, where ui is available.
--- 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")