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

Neil Martinsen-Burrell nmb at
Thu Dec 31 02:13:40 GMT 2009

I'm working on a plugin for easing the colocated branch workflow (a 
working tree in directory x, shared repository in x/.bzr/branches) and I 
would like to provide a command to remove a branch completely from the 
shared repository.  I can easily remove the branch from the 
.bzr/branches directory, but any new revisions that branch introduced 
will still be in the repository.  Since the tips of the branches in 
.bzr/branches are all of the active heads, it should be easy enough to 
find the union of their ancestry and then remove the revisions that are 
not in that set.  However, I can't find a method on Repository objects 
that allows for the removal of revisions.  Does such a thing exist 
currently?  If not, is such a thing possible with the data structures 
that we have?  That is, will adding such a thing be possible before 3.0 
or should I forget about it for now?

(The only way I know of now to accomplish this is to create a new shared 
repository, branch all of the extant branches into that new repository 
and then move the new repository into place.  This is terrible for large 
projects and is O(history) like we keep trying to avoid.)


More information about the bazaar mailing list