diff hgext3rd/topic/__init__.py @ 2924:430fb1758d28

topic: use registrar.revsetpredicate to register revset predicate functions Now, using registrar.revsetpredicate of Mercurial directly in topic extension should be safe enough. because it has been available since Mercurial 3.8, and minimum Mercurial version for topic extension is 4.0. This patch also removes modsetup() in topic/revset.py, because it is useless. BTW, this patch fixes an issue of "hg help revsets" output that custom revset predicates are not displayed as same as others, because they are not "inline literal" in reST syntax (``NAME``).
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 07 Aug 2017 23:17:13 +0900
parents 8c2d3c474fc6
children 6275808e89ef
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Mon Aug 07 23:24:57 2017 +0900
+++ b/hgext3rd/topic/__init__.py	Mon Aug 07 23:17:13 2017 +0900
@@ -187,7 +187,6 @@
 
 def uisetup(ui):
     destination.modsetup(ui)
-    topicrevset.modsetup(ui)
     discovery.modsetup(ui)
     topicmap.modsetup(ui)
     setupimportexport(ui)
@@ -309,6 +308,9 @@
             'topics', 'topic', namemap=_namemap, nodemap=_nodemap,
             listnames=lambda repo: repo.topics))
 
+# revset predicates are automatically registered at loading via this symbol
+revsetpredicate = topicrevset.revsetpredicate
+
 @command('topics', [
         ('', 'clear', False, 'clear active topic if any'),
         ('r', 'rev', [], 'revset of existing revisions', _('REV')),