diff extensions/revinfo.py @ 248:436b2db75a34

cmdutil.command is deprecated: use registrar.command instead; also need always a repository for the commands: inferrepo=True
author Franz Glasner <hg@dom66.de>
date Thu, 03 Jan 2019 23:17:13 +0100
parents 11b39af77153
children b62794e7d094
line wrap: on
line diff
--- a/extensions/revinfo.py	Thu Dec 20 00:01:59 2018 +0100
+++ b/extensions/revinfo.py	Thu Jan 03 23:17:13 2019 +0100
@@ -15,11 +15,19 @@
 
 from mercurial.i18n import _
 from mercurial import cmdutil, scmutil, util, error, archival, pycompat
+try:
+    from mercurial import registrar
+except ImportError:
+    registrar = None
 
 
 cmdtable = {}
 
-command = cmdutil.command(cmdtable)
+if registrar:
+    command = registrar.command(cmdtable)
+else:
+    command = cmdutil.command(cmdtable)
+
 
 testedwith = "3.5 3.5.1 3.5.2 4.3.1 4.3.2 4.4.1 4.4.2 4.5.2 4.6.1"
 
@@ -55,7 +63,8 @@
         ("p", "path", [], _('the configured default path'), _('SOURCE')),
         ("d", "data", [], _("add an extra `KEY: VALUE' pair into the file"), _('KEY=VALUE')),
     ],
-    _("hg revinfo [OPTION]... [DEST]"))
+    _("hg revinfo [OPTION]... [DEST]"),
+    inferrepo=True)
 def revinfo(ui, repo, dest=None, **opts):
     """write a revision summary