dirstate: filter ignored files before looping over non-normal

Summary:
D17099990 changed the way status is computed and added a loop over the
nonnormal files to find any added, removed, or merged files. Unfortunately the
nonnormal file list can contain untracked ignored files in some cases, and if
that list is large (like if someone disabled a sparse profile) this loop can
take many seconds.

Let's updated the loop to filter out ignored files. This matches a similar loop
in fsmonitor, and we may want to think about removing nonnormal handling from
the fsmonitor code entirely now that it's handled in dirstate.py.

Reviewed By: quark-zju

Differential Revision: D19190259

fbshipit-source-id: 4ba4150507fdd72439bc4e5eb731a951c6100f5f
This commit is contained in:
Durham Goode 2019-12-20 10:55:22 -08:00 committed by Facebook Github Bot
parent e41e214a01
commit e2bac56f2f

View File

@ -869,7 +869,18 @@ class dirstate(object):
# "M" files.
mtolog = self._ui.configint("experimental", "samplestatus")
nonnormalset = dmap.nonnormalset
if "treestate" in self._repo.requirements:
# treestate has a fast path to filter out ignored directories.
ignorevisitdir = ignore.visitdir
def dirfilter(path):
result = ignorevisitdir(path.rstrip("/"))
return result == "all"
nonnormalset = dmap.nonnormalsetfiltered(dirfilter)
else:
nonnormalset = dmap.nonnormalset
otherparentset = dmap.otherparentset
oldid = self.identity()