mercurial/match.py
changeset 46064 1f0ed7e63c2a
parent 45999 c4c7a6b61146
child 46819 d4ba4d51f85f
equal deleted inserted replaced
46063:88de2639901b 46064:1f0ed7e63c2a
   573     # If there's more than 5 paths in prefix_set, it's *probably* quicker to
   573     # If there's more than 5 paths in prefix_set, it's *probably* quicker to
   574     # "walk up" the directory hierarchy instead, with the assumption that most
   574     # "walk up" the directory hierarchy instead, with the assumption that most
   575     # directory hierarchies are relatively shallow and hash lookup is cheap.
   575     # directory hierarchies are relatively shallow and hash lookup is cheap.
   576     if l > 5:
   576     if l > 5:
   577         return any(
   577         return any(
   578                 parentdir in prefix_set for parentdir in pathutil.finddirs(path)
   578             parentdir in prefix_set for parentdir in pathutil.finddirs(path)
   579         )
   579         )
   580 
   580 
   581     # FIXME: Ideally we'd never get to this point if this is the case - we'd
   581     # FIXME: Ideally we'd never get to this point if this is the case - we'd
   582     # recognize ourselves as an 'always' matcher and skip this.
   582     # recognize ourselves as an 'always' matcher and skip this.
   583     if b'' in prefix_set:
   583     if b'' in prefix_set:
   638         return set(pathutil.dirs(self._fileset))
   638         return set(pathutil.dirs(self._fileset))
   639 
   639 
   640     def visitdir(self, dir):
   640     def visitdir(self, dir):
   641         if self._prefix and dir in self._fileset:
   641         if self._prefix and dir in self._fileset:
   642             return b'all'
   642             return b'all'
   643         return (
   643         return dir in self._dirs or path_or_parents_in_set(dir, self._fileset)
   644             dir in self._dirs
       
   645             or path_or_parents_in_set(dir, self._fileset)
       
   646         )
       
   647 
   644 
   648     def visitchildrenset(self, dir):
   645     def visitchildrenset(self, dir):
   649         ret = self.visitdir(dir)
   646         ret = self.visitdir(dir)
   650         if ret is True:
   647         if ret is True:
   651             return b'this'
   648             return b'this'