mercurial/revset.py
changeset 27586 42910f9fffeb
parent 27584 fc7c8cac6a4b
child 27587 c8dc480142a8
--- a/mercurial/revset.py	Tue Dec 29 23:58:30 2015 +0900
+++ b/mercurial/revset.py	Tue Dec 29 23:58:30 2015 +0900
@@ -487,11 +487,36 @@
 
     The first string argument of the constructor is used also in
     online help.
+
+    Use 'extpredicate' instead of this to register revset predicate in
+    extensions.
     """
     table = symbols
     formatdoc = "``%s``\n    %s"
     getname = registrar.funcregistrar.parsefuncdecl
 
+class extpredicate(registrar.delayregistrar):
+    """Decorator to register revset predicate in extensions
+
+    Usage::
+
+        revsetpredicate = revset.extpredicate()
+
+        @revsetpredicate('mypredicate(arg1, arg2[, arg3])')
+        def mypredicatefunc(repo, subset, x):
+            '''Explanation of this revset predicate ....
+            '''
+            pass
+
+        def uisetup(ui):
+            revsetpredicate.setup()
+
+    'revsetpredicate' instance above can be used to decorate multiple
+    functions, and 'setup()' on it registers all such functions at
+    once.
+    """
+    registrar = predicate
+
 @predicate('_destupdate')
 def _destupdate(repo, subset, x):
     # experimental revset for update destination