mercurial/dirstate.py
changeset 49357 5b7a10ddb42f
parent 49356 a87443d4aec0
child 49360 bd3519dc6741
equal deleted inserted replaced
49356:a87443d4aec0 49357:5b7a10ddb42f
   668     def clear(self):
   668     def clear(self):
   669         self._map.clear()
   669         self._map.clear()
   670         self._dirty = True
   670         self._dirty = True
   671 
   671 
   672     def rebuild(self, parent, allfiles, changedfiles=None):
   672     def rebuild(self, parent, allfiles, changedfiles=None):
       
   673 
       
   674         matcher = self._sparsematcher
       
   675         if matcher is not None and not matcher.always():
       
   676             # should not add non-matching files
       
   677             allfiles = [f for f in allfiles if matcher(f)]
       
   678             if changedfiles:
       
   679                 changedfiles = [f for f in changedfiles if matcher(f)]
       
   680 
       
   681             if changedfiles is not None:
       
   682                 # these files will be deleted from the dirstate when they are
       
   683                 # not found to be in allfiles
       
   684                 dirstatefilestoremove = {f for f in self if not matcher(f)}
       
   685                 changedfiles = dirstatefilestoremove.union(changedfiles)
       
   686 
   673         if changedfiles is None:
   687         if changedfiles is None:
   674             # Rebuild entire dirstate
   688             # Rebuild entire dirstate
   675             to_lookup = allfiles
   689             to_lookup = allfiles
   676             to_drop = []
   690             to_drop = []
   677             self.clear()
   691             self.clear()