##// END OF EJS Templates
fileset: drop matchfn...
Matt Mackall -
r14673:b0566467 default
parent child Browse files
Show More
@@ -1610,9 +1610,8 b' def debugfileset(ui, repo, expr):'
1610 if ui.verbose:
1610 if ui.verbose:
1611 tree = fileset.parse(expr)[0]
1611 tree = fileset.parse(expr)[0]
1612 ui.note(tree, "\n")
1612 ui.note(tree, "\n")
1613 matcher = lambda x: scmutil.match(repo[None], x, default='glob')
1613
1614
1614 for f in fileset.getfileset(repo[None], expr):
1615 for f in fileset.getfileset(repo[None], matcher, expr):
1616 ui.write("%s\n" % f)
1615 ui.write("%s\n" % f)
1617
1616
1618 @command('debugfsinfo', [], _('[PATH]'))
1617 @command('debugfsinfo', [], _('[PATH]'))
@@ -121,22 +121,20 b' methods = {'
121 }
121 }
122
122
123 class matchctx(object):
123 class matchctx(object):
124 def __init__(self, ctx, matchfn, subset=None):
124 def __init__(self, ctx, subset=None):
125 self.ctx = ctx
125 self.ctx = ctx
126 self.matchfn = matchfn
127 self.subset = subset
126 self.subset = subset
128 if subset is None:
127 if subset is None:
129 self.subset = ctx.walk(matchfn([])) # optimize this later
128 self.subset = ctx.walk(self.matcher([])) # optimize this later
130 def matcher(self, pattern):
129 def matcher(self, patterns):
131 return self.matchfn(pattern)
130 return self.ctx.match(patterns)
132 def filter(self, files):
131 def filter(self, files):
133 return [f for f in files if f in self.subset]
132 return [f for f in files if f in self.subset]
134 def narrow(self, files):
133 def narrow(self, files):
135 return matchctx(self.ctx, self.matchfn,
134 return matchctx(self.ctx, self.filter(files))
136 self.filter(files))
137
135
138 def getfileset(ctx, matchfn, expr):
136 def getfileset(ctx, expr):
139 tree, pos = parse(expr)
137 tree, pos = parse(expr)
140 if (pos != len(expr)):
138 if (pos != len(expr)):
141 raise error.ParseError("invalid token", pos)
139 raise error.ParseError("invalid token", pos)
142 return getset(matchctx(ctx, matchfn), tree)
140 return getset(matchctx(ctx), tree)
General Comments 0
You need to be logged in to leave comments. Login now