changeset 261:a16b86dfaf62

cmdutil.command is deprecated, use registrar.command instead; always require a repository also
author Franz Glasner <hg@dom66.de>
date Thu, 03 Jan 2019 23:19:09 +0100
parents 57e97972359e
children 71d8d1200e19
files extensions/timestamps.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/extensions/timestamps.py	Fri Dec 28 16:33:31 2018 +0100
+++ b/extensions/timestamps.py	Thu Jan 03 23:19:09 2019 +0100
@@ -74,6 +74,10 @@
 from mercurial import (cmdutil, scmutil, config, util, error, pycompat)
 from mercurial import match as _matchmod
 from mercurial import merge as _mergemod
+try:
+    from mercurial import registrar
+except ImportError:
+    registrar = None
 
 
 TIMESTAMPS_CONFIGFILE = ".hgtimestamps"
@@ -90,7 +94,10 @@
 
 cmdtable = {}
 
-command = cmdutil.command(cmdtable)
+if registrar:
+    command = registrar.command(cmdtable)
+else:
+    command = cmdutil.command(cmdtable)
 
 testedwith = "4.5.2 4.6.1"
 
@@ -130,7 +137,8 @@
         ("", "amend", None, _("amend an existing database file instead of generating a fresh one")),
         ("", "all", None, _("when importing import all timestamps instead of only the matching ones")),
     ],
-    _("hg timestamps [OPTION]..."))
+    _("hg timestamps [OPTION]..."),
+    inferrepo=True)
 def timestamps(ui, repo, **opts):
     """save or restore midification times of files