[PLUGIN] pack-indices to cleanup existing knit indices

John Arbash Meinel john at arbash-meinel.com
Fri Nov 3 23:36:50 GMT 2006


I just thought I would announce a small plugin that I just wrote, which
is designed to clean up knit indices.

A couple days ago I posted a patch to bzr.dev, which explained that the
current code is not doing dictionary compression when it should. This
plugin just iterates through a repository, and any .kndx files it finds
it reads in, and creates a new .kndx file which will be packed.

https://launchpad.net/products/bzr-pack-indices/

With the latest bzr.dev if you wanted to clean up a branch, you could
just branch it to a new location, and then everything would be packed.
But with repositories, this starts to get more difficult, as you would
have to create a new repo, branch everything into it, update the old
parent references, etc.

This simplifies all of that by just updating in place. The code checks
that the internal representation matches properly before it writes
anything out, and the transformation itself is simple enough that I
doubt it would corrupt anything.

But since it *is* rewriting files, you may want to back up your current
repository to be safe. It uses atomic rename, etc, so you can run it on
a "live" repository without causing problems. It takes out a write lock,
so other people won't write things while it is running.

Also, it works over a Transport, so it can work over sftp or bzr+ssh,
etc. It obviously can't do anything over http, and I'm not positive
about ftp, though I think ftp supports listing, so it should work.

It supports a '--dry-run' mode, which lets you find out how many files
need to be packed before you actually go and do anything about it.

I suppose we could add a '--verbose' which would print out the names of
the files to be packed. For now, it was enough for me.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061103/3e5770f8/attachment.pgp 


More information about the bazaar mailing list