##// END OF EJS Templates
match: minor cleanups to patternmatcher and includematcher...
Martin von Zweigbergk -
r33306:a9808bd1 default
parent child Browse files
Show More
@@ -358,9 +358,8 b' class patternmatcher(basematcher):'
358
358
359 self._files = _explicitfiles(kindpats)
359 self._files = _explicitfiles(kindpats)
360 self._anypats = _anypats(kindpats)
360 self._anypats = _anypats(kindpats)
361 self.patternspat, pm = _buildmatch(ctx, kindpats, '$', listsubrepos,
361 self._pats, self.matchfn = _buildmatch(ctx, kindpats, '$', listsubrepos,
362 root)
362 root)
363 self.matchfn = pm
364
363
365 @propertycache
364 @propertycache
366 def _dirs(self):
365 def _dirs(self):
@@ -379,7 +378,7 b' class patternmatcher(basematcher):'
379 return self._anypats
378 return self._anypats
380
379
381 def __repr__(self):
380 def __repr__(self):
382 return ('<patternmatcher patterns=%r>' % self.patternspat)
381 return ('<patternmatcher patterns=%r>' % self._pats)
383
382
384 class includematcher(basematcher):
383 class includematcher(basematcher):
385
384
@@ -387,15 +386,14 b' class includematcher(basematcher):'
387 badfn=None):
386 badfn=None):
388 super(includematcher, self).__init__(root, cwd, badfn)
387 super(includematcher, self).__init__(root, cwd, badfn)
389
388
390 self.includepat, im = _buildmatch(ctx, kindpats, '(?:/|$)',
389 self._pats, self.matchfn = _buildmatch(ctx, kindpats, '(?:/|$)',
391 listsubrepos, root)
390 listsubrepos, root)
392 self._anypats = _anypats(kindpats)
391 self._anypats = _anypats(kindpats)
393 roots, dirs = _rootsanddirs(kindpats)
392 roots, dirs = _rootsanddirs(kindpats)
394 # roots are directories which are recursively included.
393 # roots are directories which are recursively included.
395 self._roots = set(roots)
394 self._roots = set(roots)
396 # dirs are directories which are non-recursively included.
395 # dirs are directories which are non-recursively included.
397 self._dirs = set(dirs)
396 self._dirs = set(dirs)
398 self.matchfn = im
399
397
400 def visitdir(self, dir):
398 def visitdir(self, dir):
401 if not self._anypats and dir in self._roots:
399 if not self._anypats and dir in self._roots:
@@ -411,7 +409,7 b' class includematcher(basematcher):'
411 return True
409 return True
412
410
413 def __repr__(self):
411 def __repr__(self):
414 return ('<includematcher includes=%r>' % self.includepat)
412 return ('<includematcher includes=%r>' % self._pats)
415
413
416 class exactmatcher(basematcher):
414 class exactmatcher(basematcher):
417 '''Matches the input files exactly. They are interpreted as paths, not
415 '''Matches the input files exactly. They are interpreted as paths, not
General Comments 0
You need to be logged in to leave comments. Login now