repack: add incremental tree repacking

Summary:
Previously we only supported full repacks of the manifest stores. This patch
adds incremental repacking for both the shared manifest store and the local
manifest store.

Test Plan:
Did a few pulls to produce a few treemanifest pack files. Ran hg
repack --incremental after each one and verified it was a no-op until there were
enough pack files to trigger the repack.

Will add tests later today.

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4260602

Signature: t1:4260602:1480705304:b17d3ec5ff8d4caafe935b2c4e941454052fe3ec
This commit is contained in:
Durham Goode 2016-12-02 14:37:47 -08:00
parent 046fb2ca08
commit edd8b25c30

View File

@ -60,6 +60,25 @@ def incrementalrepack(repo):
packpath,
constants.FILEPACK_CATEGORY)
if util.safehasattr(repo.svfs, 'manifestdatastore'):
# Repack the shared manifest store
packpath = shallowutil.getcachepackpath(repo,
constants.TREEPACK_CATEGORY)
_incrementalrepack(repo,
repo.svfs.sharedmanifestdatastores,
metadatastore.unionmetadatastore(),
packpath,
constants.TREEPACK_CATEGORY)
# Repack the local manifest store
packpath = shallowutil.getlocalpackpath(repo.svfs.vfs.base,
constants.TREEPACK_CATEGORY)
_incrementalrepack(repo,
repo.svfs.localmanifestdatastores,
metadatastore.unionmetadatastore(),
packpath,
constants.TREEPACK_CATEGORY)
def _incrementalrepack(repo, datastore, historystore, packpath, category):
shallowutil.mkstickygroupdir(repo.ui, packpath)