Updates to 'bzr-repodetails'

John Arbash Meinel john at arbash-meinel.com
Tue Nov 18 20:17:33 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I decided to pick up a bit on the repodetails plugin that Robert
started. I went ahead and made a full project for it, and copied up the
code from Robert's +junk branch as the 'trunk'.

I split out the code into a separate module, so that having the plugin
installed doesn't mean loading all formats all the time. I'm not sure
that there is a huge loss here, but I figure it is still best to have
plugin __init__.py scripts as minimal as possible.

I also found this bug in the code:

    keys = sorted(keys)
    batch_size = 200
    for offset in xrange(batch_size):
        batch = keys[batch_size * offset:batch_size * (offset + 1)]

^- I'm pretty sure that means we'll only read batch_size^2 keys at
maxumum (or 40,000). So any repository which has more
texts/inventories/revisions etc will have an incorrect raw-size computed.

I changed it to this:
    batch_size = 200
    for offset in xrange(0, len(keys), batch_size):
        batch = keys[offset:offset + batch_size]

(The compressed size should be correct, but the raw size will not have
actually extracted all the keys.

Fixing this changed my results on a bzr.dev repository from:
Commits: 26757
                      Raw    %    Compressed    %  Objects
Revisions:      14305 KiB   0%     10387 KiB   9%    26757
Inventories:  3220916 KiB  65%     42626 KiB  39%    26757
Texts:        1673233 KiB  34%     50002 KiB  46%    55990
Signatures:      4166 KiB   0%      3924 KiB   3%    11011
Total:        4912621 KiB 100%    106940 KiB 100%   120515


to

Commits: 26757
                      Raw    %    Compressed    %  Objects
Revisions:      14305 KiB   0%     10387 KiB   9%    26757
Inventories:  3220916 KiB  60%     42626 KiB  39%    26757
Texts:        2106082 KiB  39%     50002 KiB  46%    55990
Signatures:      4166 KiB   0%      3924 KiB   3%    11011
Total:        5345471 KiB 100%    106940 KiB 100%   120515

You can see that it didn't change the revisions or inventories, but did
change the texts values.

Anyway, that fix was important enough that I'll go ahead and merge the
change into trunk.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkjIt0ACgkQJdeBCYSNAAOBuACgvovcu/zvQEsDNaUTaxepU3BC
wBMAn1oCuR1FYN8hAuZXO5htDcVMiJVL
=twDu
-----END PGP SIGNATURE-----



More information about the bazaar mailing list