Alternate go at fast pull: bzrbundler

Lalo Martins lalo.martins at gmail.com
Sat Sep 2 20:03:55 BST 2006


Ok, so the rpc idea sounded nice, but didn't work so well in practise (the
bzrlib abstractions don't fit it easily).

But this week I actually sat to learn mercurial, and I realised it's not
really very hard for bzr to do what it does, since we already have
bundles.  What I needed was something on the server side that generates
bundles for me, and the ability to use that from the client side.

You can get both from http://lalo.revisioncontrol.net/bzr/bzrbundler (I'd
put it on launchpad, but I don't want to register a product if I don't
know this will live more than a few days).  This address has a working
tree if you want to give it a quick test, a normal http-served branch you
can check out, and also a bundler so you can use it to test itself.

It contains a mod_python script (with examples to install it on your
apache configuration), and a plugin that patches bzrlib to:

- recognise a bundler as a bundle if you're currently inside a branch (in
which case it will generate a bundle from your current tip to the remote
branch's tip); this allows you to `bzr merge` from a bundler

- allow you to branch from a bundle if that bundle is "rooted" at the
empty tree (null revision), so you can `bzr branch` from a bundler

If people generally agree with these changes, I can reimplement them as
changes to bzr.dev and post a bundle (with unit tests).  Right now, in an
experimental stage, I'm more comfortable with them as a plugin.

This is not a substitute to the complete smart server that's being worked
on, but it's a quick fix that makes sense (IMO) on the bzr model, and that
allows us to use bzr more quickly until the smart server lands.

Known issues:

- Branching from a bundle spews "Inventory sha hash mismatch" for *every*
revision; which probably means I'm doing something wrong, but the
resulting branch always has the right contents, so I don't know that it is.

- As a bundle is not a branch, `bzr branch -r` can't use revision numbers.
It does work with revids though.  It might be possible to fake revno
support by introspecting the bundle info, I'm just not sure it's worth it.

- The "basis" argument of branch is not implemented; not sure it even
makes sense in this context.

- I only bothered to write a mod_python handler.  A CGI (or WSGI) version
is left as exercise to the reader.  Bundles (or bundlers) with one would
be gladly accepted.

Branching or merging from the bundler (from a remote server) gives me
dramatic speed increases; small branches (such as bzrbundler itself)
are almost instantaneous.  A larger branch (955 revisions, 798 items
in the inventory), however, took a long time to compute and download
the bundle, then the whole process took longer than the "usual" way
(didn't complete yet, so I don't know how long), and used horrible
amounts of CPU and memory, so it may not be really an option.

I have a rough plan for adding a "submit" command to the bundler
protocol; it will get a signed bundle, verify it against a keyring
specified in the configuration (for basic access control), and apply
it to the branch.  I'll get to it later this week if I get another
large chunk of free time.

best,
                                               Lalo Martins
-- 
      So many of our dreams at first seem impossible,
       then they seem improbable, and then, when we
       summon the will, they soon become inevitable.
--
personal:                              http://www.laranja.org/
technical:                    http://lalo.revisioncontrol.net/
GNU: never give up freedom                 http://www.gnu.org/






More information about the bazaar mailing list