diff hgext3rd/topic/__init__.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 7c15b494bacc
children fd602980f7ee
line wrap: on
line diff
--- 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',