mercurial/match.py
changeset 25188 2773540c3650
parent 25167 6f7048cc2419
child 25189 1c8c33eaea0a
equal deleted inserted replaced
25187:670c1df688fd 25188:2773540c3650
   172     @propertycache
   172     @propertycache
   173     def _dirs(self):
   173     def _dirs(self):
   174         return set(util.dirs(self._fmap)) | set(['.'])
   174         return set(util.dirs(self._fmap)) | set(['.'])
   175 
   175 
   176     def visitdir(self, dir):
   176     def visitdir(self, dir):
   177         '''Helps while traversing a directory tree. Returns the string 'all' if
   177         return (not self._fmap or '.' in self._fmap or
   178         the given directory and all subdirectories should be visited. Otherwise
   178                 dir in self._fmap or dir in self._dirs or
   179         returns True or False indicating whether the given directory should be
   179                 any(parentdir in self._fmap
   180         visited. If 'all' is returned, calling this method on a subdirectory
   180                     for parentdir in util.finddirs(dir)))
   181         gives an undefined result.'''
       
   182         if not self._fmap or self.exact(dir):
       
   183             return 'all'
       
   184         return dir in self._dirs
       
   185 
   181 
   186     def exact(self, f):
   182     def exact(self, f):
   187         '''Returns True if f is in .files().'''
   183         '''Returns True if f is in .files().'''
   188         return f in self._fmap
   184         return f in self._fmap
   189 
   185