sparse: prune the temporary file list on commit and update

Summary:
If a commit or update happens, check if the working copy is clean, and if it is,
delete all the temporarily included files. This calls hg status, which may have
perf implications, but since we're dealing with sparse checkouts, hopefully it
won't be too bad for now.

Test Plan: Ran the tests

Reviewers: sid0, pyd, lcharignon, rmcelroy

Reviewed By: rmcelroy

Differential Revision: https://phabricator.fb.com/D1982949

Signature: t1:1982949:1428635990:29ddacdf3f32a38ce0e725ed9db7e13e98e0f21e
This commit is contained in:
Durham Goode 2015-04-09 17:14:42 -07:00
parent 27e584fa9c
commit 42804877b3

View File

@ -120,6 +120,17 @@ def _setupupdates(ui):
extensions.wrapfunction(mergemod, 'calculateupdates', _calculateupdates)
def _update(orig, repo, node, branchmerge, *args, **kwargs):
results = orig(repo, node, branchmerge, *args, **kwargs)
# If we're updating to a location, clean up any stale temporary includes
# (ex: this happens during hg rebase --abort).
if not branchmerge:
repo.prunetemporaryincludes()
return results
extensions.wrapfunction(mergemod, 'update', _update)
def _setupcommit(ui):
def _refreshoncommit(orig, self, node):
"""Refresh the checkout when commits touch .hgsparse
@ -133,6 +144,8 @@ def _setupcommit(ui):
origsparsematch = repo.sparsematch()
_refresh(repo.ui, repo, origstatus, origsparsematch, True)
repo.prunetemporaryincludes()
extensions.wrapfunction(context.committablectx, 'markcommitted',
_refreshoncommit)