[rfc] bzr-colo into core

Jelmer Vernooij jelmer at canonical.com
Thu Mar 24 12:50:04 UTC 2011


On Thu, 2011-03-24 at 19:37 +1100, Martin Pool wrote:
> On 24 March 2011 11:05, Aaron Bentley <aaron at aaronbentley.com> wrote:
> > I'm in favour of colocated branch support in bzr.
> >
> > I haven't seen any discussion of bzr-colo vs bzr-colocated.  I
> > understood that bzr-colocated was designed more for tight integration
> > with bzr, where bzr-colo was designed to be usable today.  Is it worth
> > considering integrating bzr-colocated instead?
> 
> I haven't used bzr-colocated myself.  I understand from Jelmer that it
> is pretty similar to bzr-colo but with a different bzrdir format
> marker, meaning that people without the plugin installed cannot read
> it at all.  imbw.
bzr-colocated was developed in lock-step with the support for addressing
colocated branches that was being added to bzrlib (allowing you to refer
to colocated branches using URL segment parameters).

Both plugins stick "traditional" bzr branches in the .bzr/branches/
directory. bzr-colo uses a branch reference in .bzr/branch/ to track the
currently active branch (so older formats can still access  it),
bzr-colocated sticks a file with the active branch name
in .bzr/active-branch. 

Unlike bzr-colo bzr-colocated registers a new control dir format (with a
new format string, etc) which has support for colocated branches. It
also provides a converter for upgrading from meta directories to this
directory format. This has the disadvantage that any bzrdir that has
been upgraded can no longer be opened by older versions of Bazaar.

bzr-colocated is really simple (roughly 200 lines of code vs 3000 in
bzr-colo) as it relies on most of the infrastructure already being in
bzrlib. It doesn't add any extra commands for dealing with colocated
branches but relies on the existing ones. bzr-colo adds its own set of
commands that known about colocated branches. 

bzr-colo's approach is more pragmatic: it actually works with released
versions of Bazaar and doesn't require users to run bzr.dev or convert
their control directories to a format that is only usable by other users
who also have the plugin installed. On the other hand, it is less well
well integrated with the existing bzrlib API - you can't open a bzr-colo
branch using the standard bzrlib API, you can't use the bzr-colo
commands to access "colocated" branches in git or hg repositories and it
adds quite a lot of new bzr subcommands that duplicate existing
commands.

It seems like the best of both worlds would be to take bzr-colo's
approach to formats - adding the support to an existing format while
maintaining backwards compatibility - but integrate it properly with the
existing code. This would be possible by changing BzrDirMeta1 to
implement the existing colocated branch API on top of .bzr/branches/.

This would mean:

 * no upgrade is necessary
 * older versions of bzr can still access the active branch of any
   control directory that uses colocated branches
 * bzr-colo users can keep using bzr-colo, as the format doesn't change
 * API users (bzr-gtk, qbzr, bzrtools, pipelines, etc) can access  
   colocated branches independent of their format (git, hg, "builtin",
   bzr-colo, ...)
 * we can develop the UI for e.g. cloning multiple colocated branches
   independently without having to use the existing bzr-colo commands. 
   Of course, in the mean time it is still possible to use bzr-colo.

The main disadvantage would probably be performance. I'm not sure what
the performance impact is of keeping a branch reference in .bzr/branch,
including all the locking involved, and of keeping the branches as
directories with multiple files in .bzr/branches/. This seems impossible
to avoid without a format change though.

Cheers,

Jelmer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/bazaar/attachments/20110324/3cfa736b/attachment.pgp>


More information about the bazaar mailing list