[rfc] bzr-colo into core

Martin Geisler mg at aragost.com
Thu Mar 24 09:16:41 UTC 2011


Martin Pool <mbp at canonical.com> writes:

> {summary}
>
> Let's make bzr-colo the default model for bzr 3.0 in September.
>
>
> {the problem}
>
> At the moment there are various different ways to use bzr: checkouts
> from a separate repository directory; bzr-colo; checkouts with local
> commits; standalone branches. This gives users some flexibility but it
> also makes some things confusing, and it's easy for people to end up
> with a setup that's quirky, or that doesn't work well for them.

This might be totally irrelevant for your discussion, but as a Mercurial
developer, I was wondering if you have looked at how Mercurial supports
multiple branches in a single repository?

I'm asking since I find it quite simple, very uniform, and it was not
really mentioned in the discussion so far. It goes like this:

- each working copy is associated with a repository, stored inside .hg/

- each repository contains a DAG of changesets (commits)

- the changeset graph may contain multiple changesets with no children,
  we call these "heads" and this is your branch tips

This is the basic model for anonymous branches. It allows you to have
multiple anonymous branches in a single repository, or you can keep them
separate (one branch per repository) by using multiple repositories.


On top of this DAG, we have a concept of "named branches". When you
create a changeset, you can assign it a (single and immutable) branch
name. That way different parts of your DAG belong to different named
branches:

  default:  [A] --- [B] --- [C] --- [D] --- [E]
               \           /
  issue123:     [X] --- [Y] --- [Z]

Here A-E are on the "default" branch and that X-Z are on the "issue123"
branch. You can now refer to "default" everywhere Mercurial expects a
changeset identifier and it will be resolved to E, "issue123" is
resolved to Z. As new changesets are added to either branch, the branch
resolve to the tip-most changeset.

You can get a clone with issue123:

  $ hg clone --branch issue123 my-repo issue123-repo

after which issue123-repo only the relevant part:

  default:  [A]
               \
  issue123:     [X] --- [Y] --- [Z]

You can also ask for the default branch:

  $ hg clone --branch default my-repo default-repo

  default:  [A] --- [B] --- [C] --- [D] --- [E]
               \           /
  issue123:     [X] --- [Y]

Even after the split, both issue123-repo and default-repo contain parts
of both branches, but this is because they are needed by the ancestor
relationships between the changesets.

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://aragost.com/en/services/mercurial/blog/



More information about the bazaar mailing list