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

Neil Martinsen-Burrell nmb at wartburg.edu
Sat Jan 2 18:23:16 GMT 2010


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



More information about the bazaar mailing list