diff hgext3rd/evolve/hack/directaccess.py @ 2464:2b53a2a21bbb stable

deprecation: fix cmdutil.command deprecation warning
author Boris Feld <boris.feld@octobus.net>
date Mon, 22 May 2017 14:57:47 +0200
parents dd7e092a854a
children 0938f3a09a1e
line wrap: on
line diff
--- 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