125 return pat |
125 return pat |
126 return open(make_filename(repo, pat, node, total, seqno, revwidth, |
126 return open(make_filename(repo, pat, node, total, seqno, revwidth, |
127 pathname), |
127 pathname), |
128 mode) |
128 mode) |
129 |
129 |
130 def matchpats(repo, pats=[], opts={}, head='', globbed=False, default=None): |
130 def matchpats(repo, pats=[], opts={}, globbed=False, default=None): |
131 cwd = repo.getcwd() |
131 cwd = repo.getcwd() |
132 return util.cmdmatcher(repo.root, cwd, pats or [], opts.get('include'), |
132 return util.cmdmatcher(repo.root, cwd, pats or [], opts.get('include'), |
133 opts.get('exclude'), head, globbed=globbed, |
133 opts.get('exclude'), globbed=globbed, |
134 default=default) |
134 default=default) |
135 |
135 |
136 def walk(repo, pats=[], opts={}, node=None, head='', badmatch=None, |
136 def walk(repo, pats=[], opts={}, node=None, badmatch=None, globbed=False, |
137 globbed=False, default=None): |
137 default=None): |
138 files, matchfn, anypats = matchpats(repo, pats, opts, head, |
138 files, matchfn, anypats = matchpats(repo, pats, opts, globbed=globbed, |
139 globbed=globbed, default=default) |
139 default=default) |
140 exact = dict.fromkeys(files) |
140 exact = dict.fromkeys(files) |
141 for src, fn in repo.walk(node=node, files=files, match=matchfn, |
141 for src, fn in repo.walk(node=node, files=files, match=matchfn, |
142 badmatch=badmatch): |
142 badmatch=badmatch): |
143 yield src, fn, util.pathto(repo.getcwd(), fn), fn in exact |
143 yield src, fn, util.pathto(repo.getcwd(), fn), fn in exact |
144 |
144 |