( )⚙ D1228 repack: add --packsonly option to repack

This is an archive of the discontinued Mercurial Phabricator instance.

repack: add --packsonly option to repack
ClosedPublic

Authored by phillco on Oct 26 2017, 12:37 AM.
Tags
None
Subscribers
None

Details

Reviewers
durham
Group Reviewers
Restricted Project
Commits
rFBHGX0c972d6cb3a8: repack: add --packsonly option to repack
Summary

Occasionally, callers to hg repack prefer to skip loose objects and only
repack packfiles. This adds an option to do so.

Diff Detail

Repository
rFBHGX Facebook Mercurial Extensions
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

phillco created this revision.Oct 26 2017, 12:37 AM
Herald added a reviewer: Restricted Project. · View Herald TranscriptOct 26 2017, 12:37 AM
durham requested changes to this revision.Oct 26 2017, 3:53 PM

Will a future change add this to the incremental repack code?

remotefilelog/repack.py
44

getpack is somewhat of an internal only function, and not really indicative of a pack store. In theory you could have a datapack (not a datapackstore) in the repo.shareddatastore collection which should be repacked as part of --packsonly, but wouldn't trigger this condition. Instead, it might be nice to create a PackOptions struct. Maybe attach it to the ledger, then each store can look at the options and decide what it should do. Stores related to loose objects could exclude them when they see the packonly option set.

This revision now requires changes to proceed.Oct 26 2017, 3:53 PM
phillco updated this revision to Diff 3330.Nov 7 2017, 11:44 PM
phillco added inline comments.Nov 7 2017, 11:46 PM
remotefilelog/basestore.py
59–60

dict is kinda clunky here, maybe we could use attrs as Sidd suggested.

phillco planned changes to this revision.Nov 8 2017, 11:18 AM

Oops, forgot your comment about adding it to incremental repack. I'll do that now.

phillco updated this revision to Diff 3336.Nov 8 2017, 12:02 PM

OK, I added to incremental repacks too.

durham requested changes to this revision.Nov 9 2017, 11:45 AM

Requesting changes mainly because I expect that one test to actually fail now, and am confused why it doesn't.

remotefilelog/basestore.py
59

if options and options.get('packsonly'):

remotefilelog/contentstore.py
305

We should probably use a constant for the option name, so we don't typo it somewhere.

tests/test-treemanifest-repack.t
189

I think this test is checking that hg repack can repack from revlogs into pack files. So I would actually expect this to fail if you set --packsonly, since in that case the revlogs should not be inspected.

This revision now requires changes to proceed.Nov 9 2017, 11:45 AM
phillco added inline comments.Nov 9 2017, 11:54 AM
tests/test-treemanifest-repack.t
189

Ah, it's because I didn't patch serverepack(). I guess I should.

phillco updated this revision to Diff 3377.Nov 9 2017, 1:16 PM
durham accepted this revision.Nov 9 2017, 1:19 PM
durham added inline comments.
remotefilelog/constants.py
34 ↗(On Diff #3377)

markledger

This revision is now accepted and ready to land.Nov 9 2017, 1:19 PM