comparison mercurial/dirstate.py @ 25448:2bbfc2042d93

dirstate: avoid invalidating every entries when list is empty Default value was not tested with 'is None', this made empty list seen as default value and result the invalidation of every single entry in the dirstate. On repos with hundred of thousand of files, this results in minutes of lookup time instead nothing. This is a text book example of why we should test 'is None' if this is what we mean.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 04 Jun 2015 22:10:32 -0700
parents d94e403b5237
children 868b7ee8b570
comparison
equal deleted inserted replaced
25446:b5311068077e 25448:2bbfc2042d93
570 self._pl = [nullid, nullid] 570 self._pl = [nullid, nullid]
571 self._lastnormaltime = 0 571 self._lastnormaltime = 0
572 self._dirty = True 572 self._dirty = True
573 573
574 def rebuild(self, parent, allfiles, changedfiles=None): 574 def rebuild(self, parent, allfiles, changedfiles=None):
575 changedfiles = changedfiles or allfiles 575 if changedfiles is None:
576 changedfiles = allfiles
576 oldmap = self._map 577 oldmap = self._map
577 self.clear() 578 self.clear()
578 for f in allfiles: 579 for f in allfiles:
579 if f not in changedfiles: 580 if f not in changedfiles:
580 self._map[f] = oldmap[f] 581 self._map[f] = oldmap[f]