diff mercurial/fileset.py @ 28447:4eb5496c2bd4

registrar: add filesetpredicate to mark a function as fileset predicate filesetpredicate is used to replace fileset.predicate in subsequent patch. This patch also adds loadpredicate() to fileset, because this combination helps to figure out how the name of "status caller" (or "existing caller") predicate is put into _statuscallers (or _existingcallers). Listing up loadpredicate() in dispatch.extraloaders causes implicit loading fileset predicate functions at loading (3rd party) extension.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 11 Mar 2016 04:14:54 +0900
parents 4f8ced23345e
children 7108834c76a2
line wrap: on
line diff
--- a/mercurial/fileset.py	Fri Mar 11 04:14:54 2016 +0900
+++ b/mercurial/fileset.py	Fri Mar 11 04:14:54 2016 +0900
@@ -560,5 +560,15 @@
 def prettyformat(tree):
     return parser.prettyformat(tree, ('string', 'symbol'))
 
+def loadpredicate(ui, extname, registrarobj):
+    """Load fileset predicates from specified registrarobj
+    """
+    for name, func in registrarobj._table.iteritems():
+        symbols[name] = func
+        if func._callstatus:
+            _statuscallers.add(name)
+        if func._callexisting:
+            _existingcallers.add(name)
+
 # tell hggettext to extract docstrings from these functions:
 i18nfunctions = symbols.values()