store: make repack command use new repacker

Summary:
Now that all the repack logic is in place, let's switch the repack
command to use the new version. This also means the repack command will now
clean up the old remotefilelog blobs once it's finished.

Test Plan:
Ran hg repack in a large repo. Verified it deleted the old
remotefilelog blobs, and verified that I could still updated around the
repository without making any remotefilelog network requests.

A future diff will add standard .t mercurial tests for the repack command.

Reviewers: rmcelroy, ttung, lcharignon, quark, mitrandir

Reviewed By: mitrandir

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

Signature: t1:3249601:1462235506:03c0d95f6a82cfc04b340b139f39c02853941a17
This commit is contained in:
Durham Goode 2016-05-03 12:34:09 -07:00
parent 4ecb47b021
commit d2e7ae7519

View File

@ -10,6 +10,7 @@ testedwith = 'internal'
import fileserverclient, remotefilelog, remotefilectx, shallowstore, shallowrepo
import shallowbundle, debugcommands, remotefilelogserver, shallowverifier
import shallowutil, historypack, datapack
import repack as repackmod
from mercurial.node import bin, hex, nullid, nullrev, short
from mercurial.i18n import _
from mercurial.extensions import wrapfunction
@ -777,11 +778,7 @@ def prefetch(ui, repo, *pats, **opts):
@command('repack', [], _('hg repack [OPTIONS]'))
def repack(ui, repo, *pats, **opts):
datagc = datapack.datagc(repo, repo.contentstore, repo.metadatastore)
repacker = repackmod.repacker(repo, repo.contentstore, repo.metadatastore)
dpack = datapack.mutabledatapack(repo.svfs.join('packs'))
datagc.run(repo.contentstore.stores[2], dpack)
historygc = historypack.historygc(repo, repo.contentstore,
repo.metadatastore)
hpack = historypack.mutablehistorypack(repo.svfs.join('packs'))
historygc.run(repo.metadatastore.stores[2], hpack)
repacker.run(dpack, hpack)