Show More
@@ -146,8 +146,11 b' def match(root, cwd, patterns, include=N' | |||
|
146 | 146 | m = exactmatcher(root, cwd, patterns, badfn) |
|
147 | 147 | elif patterns: |
|
148 | 148 | kindpats = normalize(patterns, default, root, cwd, auditor, warn) |
|
149 | m = patternmatcher(root, cwd, kindpats, ctx=ctx, | |
|
150 | listsubrepos=listsubrepos, badfn=badfn) | |
|
149 | if _kindpatsalwaysmatch(kindpats): | |
|
150 | m = alwaysmatcher(root, cwd, badfn, relativeuipath=True) | |
|
151 | else: | |
|
152 | m = patternmatcher(root, cwd, kindpats, ctx=ctx, | |
|
153 | listsubrepos=listsubrepos, badfn=badfn) | |
|
151 | 154 | else: |
|
152 | 155 | # It's a little strange that no patterns means to match everything. |
|
153 | 156 | # Consider changing this to match nothing (probably adding a |
@@ -320,9 +323,9 b' class basematcher(object):' | |||
|
320 | 323 | class alwaysmatcher(basematcher): |
|
321 | 324 | '''Matches everything.''' |
|
322 | 325 | |
|
323 | def __init__(self, root, cwd, badfn=None): | |
|
326 | def __init__(self, root, cwd, badfn=None, relativeuipath=False): | |
|
324 | 327 | super(alwaysmatcher, self).__init__(root, cwd, badfn, |
|
325 |
relativeuipath= |
|
|
328 | relativeuipath=relativeuipath) | |
|
326 | 329 | |
|
327 | 330 | def always(self): |
|
328 | 331 | return True |
@@ -342,26 +345,17 b' class patternmatcher(basematcher):' | |||
|
342 | 345 | badfn=None): |
|
343 | 346 | super(patternmatcher, self).__init__(root, cwd, badfn) |
|
344 | 347 | |
|
345 | if not _kindpatsalwaysmatch(kindpats): | |
|
346 |
|
|
|
347 | self._anypats = _anypats(kindpats) | |
|
348 | self.patternspat, pm = _buildmatch(ctx, kindpats, '$', | |
|
349 | listsubrepos, root) | |
|
350 | self._always = False | |
|
351 | self.matchfn = pm | |
|
352 | else: | |
|
353 | self._anypats = False | |
|
354 | self.patternspat = None | |
|
355 | self._always = True | |
|
356 | self.matchfn = lambda f: True | |
|
348 | self._files = _explicitfiles(kindpats) | |
|
349 | self._anypats = _anypats(kindpats) | |
|
350 | self.patternspat, pm = _buildmatch(ctx, kindpats, '$', listsubrepos, | |
|
351 | root) | |
|
352 | self.matchfn = pm | |
|
357 | 353 | |
|
358 | 354 | @propertycache |
|
359 | 355 | def _dirs(self): |
|
360 | 356 | return set(util.dirs(self._fileset)) | {'.'} |
|
361 | 357 | |
|
362 | 358 | def visitdir(self, dir): |
|
363 | if self.always(): | |
|
364 | return 'all' | |
|
365 | 359 | if self.prefix() and dir in self._fileset: |
|
366 | 360 | return 'all' |
|
367 | 361 | return ('.' in self._fileset or |
@@ -373,9 +367,6 b' class patternmatcher(basematcher):' | |||
|
373 | 367 | def anypats(self): |
|
374 | 368 | return self._anypats |
|
375 | 369 | |
|
376 | def always(self): | |
|
377 | return self._always | |
|
378 | ||
|
379 | 370 | def __repr__(self): |
|
380 | 371 | return ('<patternmatcher patterns=%r>' % self.patternspat) |
|
381 | 372 |
General Comments 0
You need to be logged in to leave comments.
Login now