Mercurial > hg-stable
changeset 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 | b5311068077e |
children | c39640d26a4c |
files | mercurial/dirstate.py |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirstate.py Mon Jun 01 22:34:01 2015 -0700 +++ b/mercurial/dirstate.py Thu Jun 04 22:10:32 2015 -0700 @@ -572,7 +572,8 @@ self._dirty = True def rebuild(self, parent, allfiles, changedfiles=None): - changedfiles = changedfiles or allfiles + if changedfiles is None: + changedfiles = allfiles oldmap = self._map self.clear() for f in allfiles: