Is there an API function for removing revision(s) from a repository?

John Arbash Meinel john at arbash-meinel.com
Mon Jan 4 18:16:36 GMT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Neil Martinsen-Burrell wrote:
> On 2009-12-30 22:32 , John Arbash Meinel wrote:
>> If you run a Packer with a specific list of revisions (that you want to
>> keep) and include all pack files, I think that pack action will prune
>> all of the unwanted revisions. It may not prune all of the inventories
>> and texts, but I think it could go either way there.
>>
>> You could consider exposing this as part of the "Repository.pack()" api,
>> but I don't think that api should be 'lossy'. Instead, something like
>> "Repository.garbage_collect(heads)" or something like that.
> 
> Thanks, that worked, at least after a re-reading of
> PackRepository.pack() to get the post-Packer pieces correct.
> 
> I discovered one inconvenience though.  I didn't find an API to get the
> appropriate packer class from a repository.  In fact, a comment in
> GCRepositoryPackCollection._execute_pack_operations() suggests that the
> inability to get the associated Packer class leads to some code
> duplication.
> I can't discern exactly where a "_packer_class" attribute should go on
> the repository class and if it's acceptable to add it at this point.  My
> sense is that this would be necessary for adding a garbage_collect()
> method, so I didn't try.  (In my current code, I just dispatch based on
> the RepositoryFormat, judging by which of them use groupcompress_repo
> and which use pack_repo.)
> 
> -Neil
> 

Part of the problem is that the Packer class serves a couple of roles.
For KnitPack repositories, it selects between 'optimize for reading' and
'optimize for layout on disk'. (Packer vs OptimizingPacker.)

Then we leveraged the same functionality for 'clean up stuff'
(ReconcilePacker). But then we had a whole new disk format (GCCHKPacker)
that holds data in a very different way.

Using inheritance to select between several features (format,
optimize/don't optimize, clean-up/only re-use) is not a great way to go.
But mostly we've been moving away from that code path. (GCCHKPacker is
actually defined on top of the get_record_stream apis, where Packer used
to be part of the 'fetch' api.)

Anyway, you could certainly add a packer class if you felt it was necessary.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktCMIQACgkQJdeBCYSNAAMVVwCdH58USi3HhW/jSxAIC09r6TAG
an4AoLYXUNP4G8ZHcwoqh5ho2r9HcaND
=yT92
-----END PGP SIGNATURE-----



More information about the bazaar mailing list