comparison mercurial/cmdutil.py @ 6575:e08e0367ba15

walk: kill util.cmdmatcher and _matcher
author Matt Mackall <mpm@selenic.com>
date Mon, 12 May 2008 11:37:07 -0500
parents 30d3d531e11a
children 69f3e9ac7c56
comparison
equal deleted inserted replaced
6574:76af1dff402a 6575:e08e0367ba15
221 return pat 221 return pat
222 return open(make_filename(repo, pat, node, total, seqno, revwidth, 222 return open(make_filename(repo, pat, node, total, seqno, revwidth,
223 pathname), 223 pathname),
224 mode) 224 mode)
225 225
226 def matchpats(repo, pats=[], opts={}, globbed=False, default=None): 226 def matchpats(repo, pats=[], opts={}, globbed=False, default='relpath'):
227 cwd = repo.getcwd() 227 pats = pats or []
228 return util.cmdmatcher(repo.root, cwd, pats or [], opts.get('include'), 228 if not globbed and default == 'relpath':
229 opts.get('exclude'), globbed=globbed, 229 pats = util.expand_glob(pats or [])
230 default=default) 230 return util.matcher(repo.root, repo.getcwd(), pats, opts.get('include'),
231 opts.get('exclude'), None, default)
231 232
232 def walk(repo, pats=[], opts={}, node=None, badmatch=None, globbed=False, 233 def walk(repo, pats=[], opts={}, node=None, badmatch=None, globbed=False,
233 default=None): 234 default='relpath'):
234 files, matchfn, anypats = matchpats(repo, pats, opts, globbed=globbed, 235 files, matchfn, anypats = matchpats(repo, pats, opts, globbed=globbed,
235 default=default) 236 default=default)
236 exact = dict.fromkeys(files) 237 exact = dict.fromkeys(files)
237 cwd = repo.getcwd() 238 cwd = repo.getcwd()
238 for src, fn in repo.walk(node=node, files=files, match=matchfn, 239 for src, fn in repo.walk(node=node, files=files, match=matchfn,