changeset 27463:a8afdc5a7885

fileset: use set instead of list to mark predicates for efficiency (API) This reduces cost of examining whether given predicate calls 'matchctx.status()' or 'matchctx.existing()' in 'getfileset()' at runtime. This kind of examination is used also in subsequent patch, which detects unintentional 'matchctx.existing()' invocation per each predicate evaluation.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 21 Dec 2015 22:31:16 +0900
parents 470ea34ba593
children c39ecb2b86b3
files mercurial/fileset.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/fileset.py	Mon Dec 21 22:31:16 2015 +0900
+++ b/mercurial/fileset.py	Mon Dec 21 22:31:16 2015 +0900
@@ -138,10 +138,10 @@
 symbols = {}
 
 # filesets using matchctx.status()
-_statuscallers = []
+_statuscallers = set()
 
 # filesets using matchctx.existing()
-_existingcallers = []
+_existingcallers = set()
 
 def predicate(decl, callstatus=False, callexisting=False):
     """Return a decorator for fileset predicate function
@@ -164,9 +164,9 @@
             name = decl
         symbols[name] = func
         if callstatus:
-            _statuscallers.append(name)
+            _statuscallers.add(name)
         if callexisting:
-            _existingcallers.append(name)
+            _existingcallers.add(name)
         if func.__doc__:
             func.__doc__ = "``%s``\n    %s" % (decl, func.__doc__.strip())
         return func