dirstate: add an "exact" parameter to "rebuild"

Summary: This is a hint for performing certain fast paths.

Reviewed By: mitrandir77

Differential Revision: D7818730

fbshipit-source-id: 4adcf8724b462d8d652e8e580d6a36eebc46a0f8
This commit is contained in:
Jun Wu 2018-05-02 17:08:29 -07:00 committed by Facebook Github Bot
parent 77638ffcc0
commit 1b475a874d
2 changed files with 7 additions and 2 deletions

View File

@ -444,7 +444,7 @@ def _setupdirstate(ui):
replacefilecache(dirstate.dirstate, '_ignore', ignorewrapper)
# dirstate.rebuild should not add non-matching files
def _rebuild(orig, self, parent, allfiles, changedfiles=None):
def _rebuild(orig, self, parent, allfiles, changedfiles=None, exact=False):
if util.safehasattr(self.repo, 'sparsematch'):
matcher = self.repo.sparsematch()
allfiles = allfiles.matches(matcher)

View File

@ -583,8 +583,13 @@ class dirstate(object):
self._updatedfiles.clear()
self._dirty = True
def rebuild(self, parent, allfiles, changedfiles=None):
def rebuild(self, parent, allfiles, changedfiles=None, exact=False):
# If exact is True, then assume only changedfiles can be changed, and
# other files cannot be possibly changed. This is used by "absorb" as
# a hint to perform a fast path for fsmonitor and sparse.
if changedfiles is None:
if exact:
raise error.ProgrammingError('exact requires changedfiles')
# Rebuild entire dirstate
changedfiles = allfiles
lastnormaltime = self._lastnormaltime