comparison mercurial/commands.py @ 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 5cb72229f0e9
children 3c0d5016b2be da2e874fe582
comparison
equal deleted inserted replaced
40393:229d23cdb203 40394:1feb4b2c8e40
6137 fm.end() 6137 fm.end()
6138 6138
6139 def loadcmdtable(ui, name, cmdtable): 6139 def loadcmdtable(ui, name, cmdtable):
6140 """Load command functions from specified cmdtable 6140 """Load command functions from specified cmdtable
6141 """ 6141 """
6142 cmdtable = cmdtable.copy()
6143 for cmd in list(cmdtable):
6144 if not cmd.startswith('^'):
6145 continue
6146 ui.deprecwarn("old-style command registration '%s' in extension '%s'"
6147 % (cmd, name), '4.8')
6148 entry = cmdtable.pop(cmd)
6149 entry[0].helpbasic = True
6150 cmdtable[cmd[1:]] = entry
6151
6142 overrides = [cmd for cmd in cmdtable if cmd in table] 6152 overrides = [cmd for cmd in cmdtable if cmd in table]
6143 if overrides: 6153 if overrides:
6144 ui.warn(_("extension '%s' overrides commands: %s\n") 6154 ui.warn(_("extension '%s' overrides commands: %s\n")
6145 % (name, " ".join(overrides))) 6155 % (name, " ".join(overrides)))
6146 table.update(cmdtable) 6156 table.update(cmdtable)