mercurial/dirstate.py
changeset 6603 41eb20cc1c02
parent 6593 58b6ee2e6c92
child 6675 03a836ca6fde
equal deleted inserted replaced
6602:a57a27b12965 6603:41eb20cc1c02
   416                 return True
   416                 return True
   417         return False
   417         return False
   418 
   418 
   419     def walk(self, match):
   419     def walk(self, match):
   420         # filter out the src and stat
   420         # filter out the src and stat
   421         for src, f, st in self.statwalk(match.files(), match):
   421         for src, f, st in self.statwalk(match):
   422             yield f
   422             yield f
   423 
   423 
   424     def statwalk(self, files, match, unknown=True, ignored=False):
   424     def statwalk(self, match, unknown=True, ignored=False):
   425         '''
   425         '''
   426         walk recursively through the directory tree, finding all files
   426         walk recursively through the directory tree, finding all files
   427         matched by the match function
   427         matched by the match function
   428 
   428 
   429         results are yielded in a tuple (src, filename, st), where src
   429         results are yielded in a tuple (src, filename, st), where src
   440         badfn = fwarn
   440         badfn = fwarn
   441         if hasattr(match, 'bad'):
   441         if hasattr(match, 'bad'):
   442             badfn = match.bad
   442             badfn = match.bad
   443 
   443 
   444         # walk all files by default
   444         # walk all files by default
       
   445         files = match.files()
   445         if not files:
   446         if not files:
   446             files = ['.']
   447             files = ['.']
   447             dc = self._map.copy()
   448             dc = self._map.copy()
   448         else:
   449         else:
   449             files = util.unique(files)
   450             files = util.unique(files)
   567                 continue
   568                 continue
   568             known[k] = 1
   569             known[k] = 1
   569             if imatch(k):
   570             if imatch(k):
   570                 yield 'm', k, None
   571                 yield 'm', k, None
   571 
   572 
   572     def status(self, files, match, list_ignored, list_clean, list_unknown):
   573     def status(self, match, list_ignored, list_clean, list_unknown):
   573         lookup, modified, added, unknown, ignored = [], [], [], [], []
   574         lookup, modified, added, unknown, ignored = [], [], [], [], []
   574         removed, deleted, clean = [], [], []
   575         removed, deleted, clean = [], [], []
   575 
   576 
   576         files = files or []
       
   577         _join = self._join
   577         _join = self._join
   578         lstat = os.lstat
   578         lstat = os.lstat
   579         cmap = self._copymap
   579         cmap = self._copymap
   580         dmap = self._map
   580         dmap = self._map
   581         ladd = lookup.append
   581         ladd = lookup.append
   585         iadd = ignored.append
   585         iadd = ignored.append
   586         radd = removed.append
   586         radd = removed.append
   587         dadd = deleted.append
   587         dadd = deleted.append
   588         cadd = clean.append
   588         cadd = clean.append
   589 
   589 
   590         for src, fn, st in self.statwalk(files, match, unknown=list_unknown,
   590         for src, fn, st in self.statwalk(match, unknown=list_unknown,
   591                                          ignored=list_ignored):
   591                                          ignored=list_ignored):
   592             if fn not in dmap:
   592             if fn not in dmap:
   593                 if (list_ignored or fn in files) and self._dirignore(fn):
   593                 if (list_ignored or match.exact(fn)) and self._dirignore(fn):
   594                     if list_ignored:
   594                     if list_ignored:
   595                         iadd(fn)
   595                         iadd(fn)
   596                 elif list_unknown:
   596                 elif list_unknown:
   597                     uadd(fn)
   597                     uadd(fn)
   598                 continue
   598                 continue