Is it possible to delete a branch from repository?

"Olin Shivers <olin.bazaar.7ia at shivers.mail0.org>" at mongkok.dyndns.org "Olin Shivers <olin.bazaar.7ia at shivers.mail0.org>" at mongkok.dyndns.org
Mon May 18 02:24:30 BST 2009


I cannot figure out how to delete a branch in a bazaar repository --
that is, how to reclaim the storage in the top-level .bzr repository
that is not referenced by any existing branch under the repo.

I've poked around on the net and checked the documentation and the FAQ
on the bazaar web page. No luck. Can it be done?

The following little annotated experiment shows my difficulties.
    -Olin

Make a fresh repo:

    % mkdir /var/tmp/sandbox
    % cd /var/tmp/sandbox
    % bzr init-repo .
    Shared repository with trees (format: pack-0.92)
    Location:
      shared repository: .

Create a new branch inside it, a-perm, containing one small file & commit:

    % bzr init a-perm
    Created a repository tree (format: pack-0.92)
    Using shared repository: /var/tmp/sandbox/
    % cd a-perm/
    /var/tmp/sandbox/a-perm
    % echo Hello, world. > foo
    % bzr add foo; bzr commit -m "Created foo"
    adding foo
    Committing to: /var/tmp/sandbox/a-perm/
    added foo
    Committed revision 1.
    % cd ..

Create a second branch, b-tmp, and put a large (64M), incompressible
file in it. Commit.

    % bzr init b-tmp
    Created a repository tree (format: pack-0.92)
    Using shared repository: /var/tmp/sandbox/
    % cd b-tmp
    /var/tmp/sandbox/b-tmp
    % dd if=/dev/urandom of=bar bs=1k count=64k
    65536+0 records in
    65536+0 records out
    67108864 bytes (67 MB) copied, 15.789 s, 4.3 MB/s
    % du -sk .
    65660	.
    % du -sk ../.bzr
    68	../.bzr
    % bzr add bar; bzr commit -m "created bar"
    adding bar
    Committing to: /var/tmp/sandbox/b-tmp/
    added bar
    Committed revision 1.
    % cd ..

Note that the repo is now about 64MB (and so is b-tmp):

    % du -sk .bzr
    65712	.bzr
    % du -sk b-tmp/
    65660	b-tmp/

Now flush b-tmp. Note that the *repo* still has contains this 64MB bolus of
data which is no longer accessible:

    % rm -rf b-tmp
    % du -sk .bzr
    65712	.bzr
    % ls
    a-perm

Now, how do I reclaim the storage occupied by the deleted branch in the
repo? Will "pack" do it?

    % bzr pack
    % du -sk .
    131420	.

Nope -- it doubles my storage, actually! Hmm... I don't think "pack" means what
the bzr implementors think it means. How about "check"?

    % bzr check --repo
    Checking repository at 'file:///var/tmp/sandbox/'.
    checked repository <bzrlib.transport.local.LocalTransport url=file:///var/tmp/sandbox/> format <RepositoryFormatKnitPack1>
	 2 revisions
	 2 file-ids
	 2 unique file texts
	 0 repeated file texts
	 0 unreferenced text versions
    % du -sk .bzr/
    131356	.bzr/
    % 

Nope.



More information about the bazaar mailing list