mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
sparse: account for temporary includes in sparsematch creation
Summary: Now that we store a list of temporary included files, add them to the sparse matcher using our new forceincludematcher. Test Plan: Ran the tests Reviewers: sid0, pyd, lcharignon, rmcelroy Reviewed By: rmcelroy Differential Revision: https://phabricator.fb.com/D1982948 Signature: t1:1982948:1428635825:b8d2dcd94df5d75946b96cf2ac1ad29691d54066
This commit is contained in:
parent
1c30325bf5
commit
27e584fa9c
21
sparse.py
21
sparse.py
@ -267,11 +267,14 @@ def _wraprepo(ui, repo):
|
||||
includes.add('.hg*')
|
||||
return includes, excludes, profiles
|
||||
|
||||
def sparsematch(self, *revs):
|
||||
def sparsematch(self, *revs, **kwargs):
|
||||
"""Returns the sparse match function for the given revs.
|
||||
|
||||
If multiple revs are specified, the match function is the union
|
||||
of all the revs.
|
||||
|
||||
`includetemp` is used to indicate if the temporarily included file
|
||||
should be part of the matcher.
|
||||
"""
|
||||
if not revs:
|
||||
revs = [self.changelog.rev(node) for node in
|
||||
@ -282,7 +285,17 @@ def _wraprepo(ui, repo):
|
||||
mtime = os.stat(sparsepath).st_mtime
|
||||
except OSError:
|
||||
mtime = 0
|
||||
key = str(mtime) + ' '.join([str(r) for r in revs])
|
||||
|
||||
tempmtime = 0
|
||||
try:
|
||||
if kwargs.get('includetemp', True):
|
||||
tempsparsepath = self.opener.join('tempsparse')
|
||||
tempmtime = os.stat(tempsparsepath).st_mtime
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
key = '%s %s %s' % (str(mtime), str(tempmtime),
|
||||
' '.join([str(r) for r in revs]))
|
||||
result = self.sparsecache.get(key, None)
|
||||
if result:
|
||||
return result
|
||||
@ -307,6 +320,10 @@ def _wraprepo(ui, repo):
|
||||
else:
|
||||
result = unionmatcher(matchers)
|
||||
|
||||
if kwargs.get('includetemp', True):
|
||||
tempincludes = self.gettemporaryincludes()
|
||||
result = forceincludematcher(result, tempincludes)
|
||||
|
||||
self.sparsecache[key] = result
|
||||
|
||||
return result
|
||||
|
Loading…
Reference in New Issue
Block a user