# HG changeset patch # User Boris Feld # Date 1495457867 -7200 # Node ID 2b53a2a21bbb71f7ec8f28ee8138de3795b29ef6 # Parent 560175d6a83e266047f504ab2b5c7356431c8dea deprecation: fix cmdutil.command deprecation warning diff -r 560175d6a83e -r 2b53a2a21bbb hgext3rd/evolve/exthelper.py --- a/hgext3rd/evolve/exthelper.py Sun May 21 23:56:33 2017 +0200 +++ b/hgext3rd/evolve/exthelper.py Mon May 22 14:57:47 2017 +0200 @@ -3,13 +3,20 @@ ##################################################################### from mercurial import ( - cmdutil, commands, extensions, + registrar, revset, templatekw, + util, ) +if util.safehasattr(registrar, 'command'): + command = registrar.command +else: # compat with hg < 4.3 + from mercurial import cmdutil + command = cmdutil.command + class exthelper(object): """Helper for modular extension setup @@ -30,7 +37,7 @@ self._functionwrappers = [] self._duckpunchers = [] self.cmdtable = {} - self.command = cmdutil.command(self.cmdtable) + self.command = command(self.cmdtable) def merge(self, other): self._uicallables.extend(other._uicallables) diff -r 560175d6a83e -r 2b53a2a21bbb hgext3rd/evolve/hack/directaccess.py --- a/hgext3rd/evolve/hack/directaccess.py Sun May 21 23:56:33 2017 +0200 +++ b/hgext3rd/evolve/hack/directaccess.py Mon May 22 14:57:47 2017 +0200 @@ -6,9 +6,9 @@ to xxx. """ from mercurial import extensions -from mercurial import cmdutil from mercurial import repoview from mercurial import branchmap +from mercurial import registrar from mercurial import revset from mercurial import error from mercurial import commands @@ -17,7 +17,12 @@ from mercurial.i18n import _ cmdtable = {} -command = cmdutil.command(cmdtable) + +if util.safehasattr(registrar, 'command'): + command = registrar.command(cmdtable) +else: # compat with hg < 4.3 + from mercurial import cmdutil + command = cmdutil.command(cmdtable) # By default, all the commands have directaccess with warnings # List of commands that have no directaccess and directaccess with no warning diff -r 560175d6a83e -r 2b53a2a21bbb hgext3rd/evolve/hack/drophack.py --- a/hgext3rd/evolve/hack/drophack.py Sun May 21 23:56:33 2017 +0200 +++ b/hgext3rd/evolve/hack/drophack.py Mon May 22 14:57:47 2017 +0200 @@ -12,7 +12,7 @@ import contextlib from mercurial.i18n import _ -from mercurial import cmdutil +from mercurial import registrar from mercurial import repair from mercurial import scmutil from mercurial import lock as lockmod @@ -20,7 +20,12 @@ from mercurial import commands cmdtable = {} -command = cmdutil.command(cmdtable) + +if util.safehasattr(registrar, 'command'): + command = registrar.command(cmdtable) +else: # compat with hg < 4.3 + from mercurial import cmdutil + command = cmdutil.command(cmdtable) @contextlib.contextmanager diff -r 560175d6a83e -r 2b53a2a21bbb hgext3rd/evolve/hack/inhibit.py --- a/hgext3rd/evolve/hack/inhibit.py Sun May 21 23:56:33 2017 +0200 +++ b/hgext3rd/evolve/hack/inhibit.py Mon May 22 14:57:47 2017 +0200 @@ -14,20 +14,25 @@ However as the inhibitor are not fitting in an append only model, this is incompatible with sharing mutable history. """ -from mercurial import localrepo -from mercurial import obsolete -from mercurial import extensions -from mercurial import cmdutil +from mercurial import bookmarks +from mercurial import commands from mercurial import error +from mercurial import extensions +from mercurial import localrepo +from mercurial import lock as lockmod +from mercurial import obsolete +from mercurial import registrar from mercurial import scmutil -from mercurial import commands -from mercurial import lock as lockmod -from mercurial import bookmarks from mercurial import util from mercurial.i18n import _ cmdtable = {} -command = cmdutil.command(cmdtable) + +if util.safehasattr(registrar, 'command'): + command = registrar.command(cmdtable) +else: # compat with hg < 4.3 + from mercurial import cmdutil + command = cmdutil.command(cmdtable) def _inhibitenabled(repo): return util.safehasattr(repo, '_obsinhibit') diff -r 560175d6a83e -r 2b53a2a21bbb hgext3rd/evolve/legacy.py --- a/hgext3rd/evolve/legacy.py Sun May 21 23:56:33 2017 +0200 +++ b/hgext3rd/evolve/legacy.py Mon May 22 14:57:47 2017 +0200 @@ -24,12 +24,17 @@ import sys import json -from mercurial import cmdutil from mercurial.i18n import _ from mercurial import lock as lockmod from mercurial.node import bin, nullid +from mercurial import registrar from mercurial import util +if util.safehasattr(registrar, 'command'): + commandfunc = registrar.command +else: # compat with hg < 4.3 + from mercurial import cmdutil + commandfunc = cmdutil.command ##################################################################### ### Older format management ### @@ -75,7 +80,7 @@ return rels cmdtable = {} -command = cmdutil.command(cmdtable) +command = commandfunc(cmdtable) @command('debugconvertobsolete', [], '') def cmddebugconvertobsolete(ui, repo): """import markers from an .hg/obsolete-relations file""" diff -r 560175d6a83e -r 2b53a2a21bbb hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Sun May 21 23:56:33 2017 +0200 +++ b/hgext3rd/topic/__init__.py Mon May 22 14:57:47 2017 +0200 @@ -69,6 +69,7 @@ obsolete, patch, phases, + registrar, util, ) @@ -81,8 +82,13 @@ discovery, ) +if util.safehasattr(registrar, 'command'): + commandfunc = registrar.command +else: # compat with hg < 4.3 + commandfunc = cmdutil.command + cmdtable = {} -command = cmdutil.command(cmdtable) +command = commandfunc(cmdtable) colortable = {'topic.active': 'green', 'topic.list.troubledcount': 'red', 'topic.list.headcount.multiple': 'yellow',