diff mercurial/fileset.py @ 38613:760cc5dc01e8

fileset: restrict getfileset() to not return a computed set (API) And rename the functions accordingly. fileset.match() will be changed to not compute the initial subset. test-glog*.t get back to the state before 9f9ffe5f687c "match: compose 'set:' pattern as matcher."
author Yuya Nishihara <yuya@tcha.org>
date Sat, 09 Jun 2018 20:53:12 +0900
parents d046bf37f1ba
children 5cbcbe51d38d
line wrap: on
line diff
--- a/mercurial/fileset.py	Sat Jun 09 22:04:07 2018 +0900
+++ b/mercurial/fileset.py	Sat Jun 09 20:53:12 2018 +0900
@@ -620,9 +620,14 @@
     else:
         return list(ctx.walk(ctx.match([])))
 
-def getfileset(ctx, expr):
+def match(ctx, expr, badfn=None):
+    """Create a matcher for a single fileset expression"""
+    repo = ctx.repo()
     tree = parse(expr)
-    return getset(fullmatchctx(ctx, _buildstatus(ctx, tree)), tree)
+    fset = getset(fullmatchctx(ctx, _buildstatus(ctx, tree)), tree)
+    return matchmod.predicatematcher(repo.root, repo.getcwd(),
+                                     fset.__contains__,
+                                     predrepr='fileset', badfn=badfn)
 
 def _buildstatus(ctx, tree, basectx=None):
     # do we need status info?