Show More
@@ -445,11 +445,14 b' class includematcher(basematcher):' | |||
|
445 | 445 | self._pats, self.matchfn = _buildmatch(kindpats, '(?:/|$)', |
|
446 | 446 | listsubrepos, root) |
|
447 | 447 | self._prefix = _prefix(kindpats) |
|
448 |
roots, dirs = _roots |
|
|
448 | roots, dirs, parents = _rootsdirsandparents(kindpats) | |
|
449 | 449 | # roots are directories which are recursively included. |
|
450 | 450 | self._roots = set(roots) |
|
451 | 451 | # dirs are directories which are non-recursively included. |
|
452 | 452 | self._dirs = set(dirs) |
|
453 | # parents are directories which are non-recursively included because | |
|
454 | # they are needed to get to items in _dirs or _roots. | |
|
455 | self._parents = set(parents) | |
|
453 | 456 | |
|
454 | 457 | def visitdir(self, dir): |
|
455 | 458 | if self._prefix and dir in self._roots: |
@@ -457,6 +460,7 b' class includematcher(basematcher):' | |||
|
457 | 460 | return ('.' in self._roots or |
|
458 | 461 | dir in self._roots or |
|
459 | 462 | dir in self._dirs or |
|
463 | dir in self._parents or | |
|
460 | 464 | any(parentdir in self._roots |
|
461 | 465 | for parentdir in util.finddirs(dir))) |
|
462 | 466 | |
@@ -1004,7 +1008,7 b' def _roots(kindpats):' | |||
|
1004 | 1008 | roots, dirs = _patternrootsanddirs(kindpats) |
|
1005 | 1009 | return roots |
|
1006 | 1010 | |
|
1007 |
def _roots |
|
|
1011 | def _rootsdirsandparents(kindpats): | |
|
1008 | 1012 | '''Returns roots and exact directories from patterns. |
|
1009 | 1013 | |
|
1010 | 1014 | roots are directories to match recursively, whereas exact directories should |
@@ -1012,32 +1016,33 b' def _rootsanddirs(kindpats):' | |||
|
1012 | 1016 | include directories that need to be implicitly considered as either, such as |
|
1013 | 1017 | parent directories. |
|
1014 | 1018 | |
|
1015 |
>>> _roots |
|
|
1019 | >>> _rootsdirsandparents( | |
|
1016 | 1020 | ... [(b'glob', b'g/h/*', b''), (b'glob', b'g/h', b''), |
|
1017 | 1021 | ... (b'glob', b'g*', b'')]) |
|
1018 | (['g/h', 'g/h', '.'], ['g', '.']) | |
|
1019 |
>>> _roots |
|
|
1022 | (['g/h', 'g/h', '.'], [], ['g', '.']) | |
|
1023 | >>> _rootsdirsandparents( | |
|
1020 | 1024 | ... [(b'rootfilesin', b'g/h', b''), (b'rootfilesin', b'', b'')]) |
|
1021 | ([], ['g/h', '.', 'g', '.']) | |
|
1022 |
>>> _roots |
|
|
1025 | ([], ['g/h', '.'], ['g', '.']) | |
|
1026 | >>> _rootsdirsandparents( | |
|
1023 | 1027 | ... [(b'relpath', b'r', b''), (b'path', b'p/p', b''), |
|
1024 | 1028 | ... (b'path', b'', b'')]) |
|
1025 | (['r', 'p/p', '.'], ['p', '.']) | |
|
1026 |
>>> _roots |
|
|
1029 | (['r', 'p/p', '.'], [], ['p', '.']) | |
|
1030 | >>> _rootsdirsandparents( | |
|
1027 | 1031 | ... [(b'relglob', b'rg*', b''), (b're', b're/', b''), |
|
1028 | 1032 | ... (b'relre', b'rr', b'')]) |
|
1029 | (['.', '.', '.'], ['.']) | |
|
1033 | (['.', '.', '.'], [], ['.']) | |
|
1030 | 1034 | ''' |
|
1031 | 1035 | r, d = _patternrootsanddirs(kindpats) |
|
1032 | 1036 | |
|
1037 | p = [] | |
|
1033 | 1038 | # Append the parents as non-recursive/exact directories, since they must be |
|
1034 | 1039 | # scanned to get to either the roots or the other exact directories. |
|
1035 |
|
|
|
1036 |
|
|
|
1040 | p.extend(util.dirs(d)) | |
|
1041 | p.extend(util.dirs(r)) | |
|
1037 | 1042 | # util.dirs() does not include the root directory, so add it manually |
|
1038 |
|
|
|
1043 | p.append('.') | |
|
1039 | 1044 | |
|
1040 | return r, d | |
|
1045 | return r, d, p | |
|
1041 | 1046 | |
|
1042 | 1047 | def _explicitfiles(kindpats): |
|
1043 | 1048 | '''Returns the potential explicit filenames from the patterns. |
General Comments 0
You need to be logged in to leave comments.
Login now