Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 4200:b5d1eaade333
Merge a bunch of matcher and locate fixes.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sat, 10 Mar 2007 23:21:33 -0300 |
parents | eb5d4fec1487 492d0d5b6976 |
children | dbc3846c09a1 |
comparison
equal
deleted
inserted
replaced
4182:ba51a8225a60 | 4200:b5d1eaade333 |
---|---|
123 return pat | 123 return pat |
124 return open(make_filename(repo, pat, node, total, seqno, revwidth, | 124 return open(make_filename(repo, pat, node, total, seqno, revwidth, |
125 pathname), | 125 pathname), |
126 mode) | 126 mode) |
127 | 127 |
128 def matchpats(repo, pats=[], opts={}, head='', globbed=False): | 128 def matchpats(repo, pats=[], opts={}, globbed=False, default=None): |
129 cwd = repo.getcwd() | 129 cwd = repo.getcwd() |
130 if not pats and cwd: | 130 return util.cmdmatcher(repo.root, cwd, pats or [], opts.get('include'), |
131 opts['include'] = [os.path.join(cwd, i) | 131 opts.get('exclude'), globbed=globbed, |
132 for i in opts.get('include', [])] | 132 default=default) |
133 opts['exclude'] = [os.path.join(cwd, x) | 133 |
134 for x in opts.get('exclude', [])] | 134 def walk(repo, pats=[], opts={}, node=None, badmatch=None, globbed=False, |
135 cwd = '' | 135 default=None): |
136 return util.cmdmatcher(repo.root, cwd, pats or ['.'], opts.get('include'), | 136 files, matchfn, anypats = matchpats(repo, pats, opts, globbed=globbed, |
137 opts.get('exclude'), head, globbed=globbed) | 137 default=default) |
138 | |
139 def walk(repo, pats=[], opts={}, node=None, head='', badmatch=None, | |
140 globbed=False): | |
141 files, matchfn, anypats = matchpats(repo, pats, opts, head, | |
142 globbed=globbed) | |
143 exact = dict.fromkeys(files) | 138 exact = dict.fromkeys(files) |
144 for src, fn in repo.walk(node=node, files=files, match=matchfn, | 139 for src, fn in repo.walk(node=node, files=files, match=matchfn, |
145 badmatch=badmatch): | 140 badmatch=badmatch): |
146 yield src, fn, util.pathto(repo.getcwd(), fn), fn in exact | 141 yield src, fn, util.pathto(repo.getcwd(), fn), fn in exact |
147 | 142 |