##// END OF EJS Templates
match: optimize visitdir() for patterns matching only root directory...
Martin von Zweigbergk -
r32176:cf042543 default
parent child Browse files
Show More
@@ -134,7 +134,7 b' class match(object):'
134 self._includeroots = set()
134 self._includeroots = set()
135 self._excluderoots = set()
135 self._excluderoots = set()
136 # dirs are directories which are non-recursively included.
136 # dirs are directories which are non-recursively included.
137 self._includedirs = set(['.'])
137 self._includedirs = set()
138
138
139 if badfn is not None:
139 if badfn is not None:
140 self.bad = badfn
140 self.bad = badfn
@@ -254,7 +254,7 b' class match(object):'
254 return 'all'
254 return 'all'
255 if dir in self._excluderoots:
255 if dir in self._excluderoots:
256 return False
256 return False
257 if ((self._includeroots or self._includedirs != set(['.'])) and
257 if ((self._includeroots or self._includedirs) and
258 '.' not in self._includeroots and
258 '.' not in self._includeroots and
259 dir not in self._includeroots and
259 dir not in self._includeroots and
260 dir not in self._includedirs and
260 dir not in self._includedirs and
@@ -684,16 +684,16 b' def _rootsanddirs(kindpats):'
684
684
685 >>> _rootsanddirs(\
685 >>> _rootsanddirs(\
686 [('glob', 'g/h/*', ''), ('glob', 'g/h', ''), ('glob', 'g*', '')])
686 [('glob', 'g/h/*', ''), ('glob', 'g/h', ''), ('glob', 'g*', '')])
687 (['g/h', 'g/h', '.'], ['g'])
687 (['g/h', 'g/h', '.'], ['g', '.'])
688 >>> _rootsanddirs(\
688 >>> _rootsanddirs(\
689 [('rootfilesin', 'g/h', ''), ('rootfilesin', '', '')])
689 [('rootfilesin', 'g/h', ''), ('rootfilesin', '', '')])
690 ([], ['g/h', '.', 'g'])
690 ([], ['g/h', '.', 'g', '.'])
691 >>> _rootsanddirs(\
691 >>> _rootsanddirs(\
692 [('relpath', 'r', ''), ('path', 'p/p', ''), ('path', '', '')])
692 [('relpath', 'r', ''), ('path', 'p/p', ''), ('path', '', '')])
693 (['r', 'p/p', '.'], ['p'])
693 (['r', 'p/p', '.'], ['p', '.'])
694 >>> _rootsanddirs(\
694 >>> _rootsanddirs(\
695 [('relglob', 'rg*', ''), ('re', 're/', ''), ('relre', 'rr', '')])
695 [('relglob', 'rg*', ''), ('re', 're/', ''), ('relre', 'rr', '')])
696 (['.', '.', '.'], [])
696 (['.', '.', '.'], ['.'])
697 '''
697 '''
698 r, d = _patternrootsanddirs(kindpats)
698 r, d = _patternrootsanddirs(kindpats)
699
699
@@ -701,6 +701,8 b' def _rootsanddirs(kindpats):'
701 # scanned to get to either the roots or the other exact directories.
701 # scanned to get to either the roots or the other exact directories.
702 d.extend(util.dirs(d))
702 d.extend(util.dirs(d))
703 d.extend(util.dirs(r))
703 d.extend(util.dirs(r))
704 # util.dirs() does not include the root directory, so add it manually
705 d.append('.')
704
706
705 return r, d
707 return r, d
706
708
General Comments 0
You need to be logged in to leave comments. Login now