equal
deleted
inserted
replaced
121 if not matchfn(f): |
121 if not matchfn(f): |
122 return False |
122 return False |
123 return True |
123 return True |
124 |
124 |
125 self.matchfn = m |
125 self.matchfn = m |
126 self._fmap = set(self._files) |
126 self._fileroots = set(self._files) |
127 |
127 |
128 def __call__(self, fn): |
128 def __call__(self, fn): |
129 return self.matchfn(fn) |
129 return self.matchfn(fn) |
130 def __iter__(self): |
130 def __iter__(self): |
131 for f in self._files: |
131 for f in self._files: |
169 else: optimal roots''' |
169 else: optimal roots''' |
170 return self._files |
170 return self._files |
171 |
171 |
172 @propertycache |
172 @propertycache |
173 def _dirs(self): |
173 def _dirs(self): |
174 return set(util.dirs(self._fmap)) | set(['.']) |
174 return set(util.dirs(self._fileroots)) | set(['.']) |
175 |
175 |
176 def visitdir(self, dir): |
176 def visitdir(self, dir): |
177 return (not self._fmap or '.' in self._fmap or |
177 return (not self._fileroots or '.' in self._fileroots or |
178 dir in self._fmap or dir in self._dirs or |
178 dir in self._fileroots or dir in self._dirs or |
179 any(parentdir in self._fmap |
179 any(parentdir in self._fileroots |
180 for parentdir in util.finddirs(dir))) |
180 for parentdir in util.finddirs(dir))) |
181 |
181 |
182 def exact(self, f): |
182 def exact(self, f): |
183 '''Returns True if f is in .files().''' |
183 '''Returns True if f is in .files().''' |
184 return f in self._fmap |
184 return f in self._fileroots |
185 |
185 |
186 def anypats(self): |
186 def anypats(self): |
187 '''Matcher uses patterns or include/exclude.''' |
187 '''Matcher uses patterns or include/exclude.''' |
188 return self._anypats |
188 return self._anypats |
189 |
189 |
274 |
274 |
275 self._files = [f[len(path) + 1:] for f in matcher._files |
275 self._files = [f[len(path) + 1:] for f in matcher._files |
276 if f.startswith(path + "/")] |
276 if f.startswith(path + "/")] |
277 self._anypats = matcher._anypats |
277 self._anypats = matcher._anypats |
278 self.matchfn = lambda fn: matcher.matchfn(self._path + "/" + fn) |
278 self.matchfn = lambda fn: matcher.matchfn(self._path + "/" + fn) |
279 self._fmap = set(self._files) |
279 self._fileroots = set(self._files) |
280 |
280 |
281 def abs(self, f): |
281 def abs(self, f): |
282 return self._matcher.abs(self._path + "/" + f) |
282 return self._matcher.abs(self._path + "/" + f) |
283 |
283 |
284 def bad(self, f, msg): |
284 def bad(self, f, msg): |
301 ctx=ctx, listsubrepos=listsubrepos) |
301 ctx=ctx, listsubrepos=listsubrepos) |
302 |
302 |
303 # m.exact(file) must be based off of the actual user input, otherwise |
303 # m.exact(file) must be based off of the actual user input, otherwise |
304 # inexact case matches are treated as exact, and not noted without -v. |
304 # inexact case matches are treated as exact, and not noted without -v. |
305 if self._files: |
305 if self._files: |
306 self._fmap = set(_roots(self._kp)) |
306 self._fileroots = set(_roots(self._kp)) |
307 |
307 |
308 def _normalize(self, patterns, default, root, cwd, auditor): |
308 def _normalize(self, patterns, default, root, cwd, auditor): |
309 self._kp = super(icasefsmatcher, self)._normalize(patterns, default, |
309 self._kp = super(icasefsmatcher, self)._normalize(patterns, default, |
310 root, cwd, auditor) |
310 root, cwd, auditor) |
311 kindpats = [] |
311 kindpats = [] |