mercurial/match.py
changeset 42361 c4b8f8637d7a
parent 42346 38d85ec06552
child 42362 52beb1b8a649
equal deleted inserted replaced
42360:3293086ff663 42361:c4b8f8637d7a
   612         self._roots = set(roots)
   612         self._roots = set(roots)
   613         # dirs are directories which are non-recursively included.
   613         # dirs are directories which are non-recursively included.
   614         self._dirs = set(dirs)
   614         self._dirs = set(dirs)
   615         # parents are directories which are non-recursively included because
   615         # parents are directories which are non-recursively included because
   616         # they are needed to get to items in _dirs or _roots.
   616         # they are needed to get to items in _dirs or _roots.
   617         self._parents = set(parents)
   617         self._parents = parents
   618 
   618 
   619     def visitdir(self, dir):
   619     def visitdir(self, dir):
   620         dir = normalizerootdir(dir, 'visitdir')
   620         dir = normalizerootdir(dir, 'visitdir')
   621         if self._prefix and dir in self._roots:
   621         if self._prefix and dir in self._roots:
   622             return 'all'
   622             return 'all'
  1382     Returns a tuple of (roots, dirs, parents).
  1382     Returns a tuple of (roots, dirs, parents).
  1383 
  1383 
  1384     >>> _rootsdirsandparents(
  1384     >>> _rootsdirsandparents(
  1385     ...     [(b'glob', b'g/h/*', b''), (b'glob', b'g/h', b''),
  1385     ...     [(b'glob', b'g/h/*', b''), (b'glob', b'g/h', b''),
  1386     ...      (b'glob', b'g*', b'')])
  1386     ...      (b'glob', b'g*', b'')])
  1387     (['g/h', 'g/h', ''], [], ['', 'g'])
  1387     (['g/h', 'g/h', ''], [], set(['', 'g']))
  1388     >>> _rootsdirsandparents(
  1388     >>> _rootsdirsandparents(
  1389     ...     [(b'rootfilesin', b'g/h', b''), (b'rootfilesin', b'', b'')])
  1389     ...     [(b'rootfilesin', b'g/h', b''), (b'rootfilesin', b'', b'')])
  1390     ([], ['g/h', ''], ['', 'g'])
  1390     ([], ['g/h', ''], set(['', 'g']))
  1391     >>> _rootsdirsandparents(
  1391     >>> _rootsdirsandparents(
  1392     ...     [(b'relpath', b'r', b''), (b'path', b'p/p', b''),
  1392     ...     [(b'relpath', b'r', b''), (b'path', b'p/p', b''),
  1393     ...      (b'path', b'', b'')])
  1393     ...      (b'path', b'', b'')])
  1394     (['r', 'p/p', ''], [], ['', 'p'])
  1394     (['r', 'p/p', ''], [], set(['', 'p']))
  1395     >>> _rootsdirsandparents(
  1395     >>> _rootsdirsandparents(
  1396     ...     [(b'relglob', b'rg*', b''), (b're', b're/', b''),
  1396     ...     [(b'relglob', b'rg*', b''), (b're', b're/', b''),
  1397     ...      (b'relre', b'rr', b'')])
  1397     ...      (b'relre', b'rr', b'')])
  1398     (['', '', ''], [], [''])
  1398     (['', '', ''], [], set(['']))
  1399     '''
  1399     '''
  1400     r, d = _patternrootsanddirs(kindpats)
  1400     r, d = _patternrootsanddirs(kindpats)
  1401 
  1401 
  1402     p = []
  1402     p = set()
  1403     # Append the parents as non-recursive/exact directories, since they must be
  1403     # Add the parents as non-recursive/exact directories, since they must be
  1404     # scanned to get to either the roots or the other exact directories.
  1404     # scanned to get to either the roots or the other exact directories.
  1405     p.extend(util.dirs(d))
  1405     p.update(util.dirs(d))
  1406     p.extend(util.dirs(r))
  1406     p.update(util.dirs(r))
  1407 
  1407 
  1408     # FIXME: all uses of this function convert these to sets, do so before
  1408     # FIXME: all uses of this function convert these to sets, do so before
  1409     # returning.
  1409     # returning.
  1410     # FIXME: all uses of this function do not need anything in 'roots' and
  1410     # FIXME: all uses of this function do not need anything in 'roots' and
  1411     # 'dirs' to also be in 'parents', consider removing them before returning.
  1411     # 'dirs' to also be in 'parents', consider removing them before returning.