hgext3rd/topic/__init__.py
changeset 2912 1341ff3ba4a9
parent 2909 9ce092b17530
child 2915 b3abdb3d819e
--- a/hgext3rd/topic/__init__.py	Thu Sep 07 16:45:53 2017 +0200
+++ b/hgext3rd/topic/__init__.py	Sun Sep 10 22:22:06 2017 +0900
@@ -70,7 +70,6 @@
     namespaces,
     node,
     obsolete,
-    obsutil,
     patch,
     phases,
     registrar,
@@ -728,6 +727,16 @@
             fm.plain('\n')
     fm.end()
 
+getmarkers = None
+try:
+    from mercurial import obsutil
+    getmarkers = getattr(obsutil, 'getmarkers', None)
+except ImportError:
+    pass
+
+if getmarkers is None:
+    getmarkers = obsolete.getmarkers
+
 def _getlasttouched(repo, topics):
     """
     Calculates the last time a topic was used. Returns a dictionary of seconds
@@ -749,7 +758,7 @@
                 maxtime = rt
             # looking on the markers also to get more information and accurate
             # last touch time.
-            obsmarkers = obsutil.getmarkers(repo, [repo[revs].node()])
+            obsmarkers = getmarkers(repo, [repo[revs].node()])
             for marker in obsmarkers:
                 rt = marker.date()
                 if rt[0] > maxtime[0]: