changeset 14673:b0566467c492

fileset: drop matchfn This is now built into contexts
author Matt Mackall <mpm@selenic.com>
date Sat, 18 Jun 2011 16:52:51 -0500
parents 785bbc8634f8
children 1c151b963254
files mercurial/commands.py mercurial/fileset.py
diffstat 2 files changed, 9 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Jun 18 16:52:51 2011 -0500
+++ b/mercurial/commands.py	Sat Jun 18 16:52:51 2011 -0500
@@ -1610,9 +1610,8 @@
     if ui.verbose:
         tree = fileset.parse(expr)[0]
         ui.note(tree, "\n")
-    matcher = lambda x: scmutil.match(repo[None], x, default='glob')
-
-    for f in fileset.getfileset(repo[None], matcher, expr):
+
+    for f in fileset.getfileset(repo[None], expr):
         ui.write("%s\n" % f)
 
 @command('debugfsinfo', [], _('[PATH]'))
--- a/mercurial/fileset.py	Sat Jun 18 16:52:51 2011 -0500
+++ b/mercurial/fileset.py	Sat Jun 18 16:52:51 2011 -0500
@@ -121,22 +121,20 @@
 }
 
 class matchctx(object):
-    def __init__(self, ctx, matchfn, subset=None):
+    def __init__(self, ctx, subset=None):
         self.ctx = ctx
-        self.matchfn = matchfn
         self.subset = subset
         if subset is None:
-            self.subset = ctx.walk(matchfn([])) # optimize this later
-    def matcher(self, pattern):
-        return self.matchfn(pattern)
+            self.subset = ctx.walk(self.matcher([])) # optimize this later
+    def matcher(self, patterns):
+        return self.ctx.match(patterns)
     def filter(self, files):
         return [f for f in files if f in self.subset]
     def narrow(self, files):
-        return matchctx(self.ctx, self.matchfn,
-                        self.filter(files))
+        return matchctx(self.ctx, self.filter(files))
 
-def getfileset(ctx, matchfn, expr):
+def getfileset(ctx, expr):
     tree, pos = parse(expr)
     if (pos != len(expr)):
         raise error.ParseError("invalid token", pos)
-    return getset(matchctx(ctx, matchfn), tree)
+    return getset(matchctx(ctx), tree)