Deleting a branch from a repository
Olin Shivers
shivers at ccs.neu.edu
Mon May 18 01:47:59 BST 2009
It appears that it is impossible to delete a branch from a repository.
I.e., there's no way to gc a repository and have all unreferenced
storage reclaimed. Is this correct? If so, this seems to be a serious
flaw.
I've poked around on the net and found no answers. 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 64MB file is still occupying space in the
actual .bzr repository:
% 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