[PATCH] commands: restore compatibility for "^cmd" registration (issue6005)

Boris FELD lothiraldan at gmail.com
Mon Oct 22 09:41:30 EDT 2018


This patch looks good!

On 18/10/2018 14:29, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1539864862 -32400
> #      Thu Oct 18 21:14:22 2018 +0900
> # Node ID 21cf5d2d5b7e2c5264bc132285cdd042c21d2b38
> # Parent  10e4e6d63c504f1117b0d49160e301d21818515f
> commands: restore compatibility for "^cmd" registration (issue6005)
>
> This is done at loading time, where ui is available.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -6135,6 +6135,16 @@ def version_(ui, **opts):
>  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")
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list