Branches in general

Eric M. Hopper hopper at omnifarious.org
Sat Jun 9 11:57:42 CDT 2007


On Fri, 2007-06-08 at 20:19 -0700, Brendan Cully wrote:

> As you know, I also have my doubts about hg's branches, but I'd be
> curious to know what the specific drawbacks were, and how current the
> implementation was. Most of the UI work to make branches halfway
> reasonable happened after 0.9.3 was released. Some of it is only a few
> days old...


Here is one concrete problem...

A revision can be in more than one branch at a time.

The specific case of this is fast-forward merge:


A1--A2--A3        A4------A5
         \        /       /
         B1--B2--B3--B4--B5


So, in this case, what you really did when you merged B3 is that you
said that B1->B3 are now also part of branch A.  Because Mercurial
associates one branch per revision, this is not possible to represent,
and so an artificial revision is created on branch A to represent this.

Now, when a revision is developed, it is developed on one and only one
branch.  In this sense, the per-revision branch tag is like a comment
about the revision.  You're saying "This revision was developed for
branch B.".  And that can be a useful thing to know, but it is
inadequate for determining which branch a particular revision is on.

Currently there is sort of an ad-hoc (mostly because I think people
started using it without really thinking hard about it) heuristic used
that if a revision is the ancestor of a revision on a particular branch,
that revision is on that branch too.  My heads -b code makes fairly
explicit use of this heuristic in guessing about branch heads.

But this again leads to the case I just mentioned with fast-forward
merges.  It makes it sometimes necessary to create a new revision who's
only purpose is to be a child in a particular branch so all its
ancestors can be considered to be on that branch too.

I hope this makes sense,
-- 
The best we can hope for concerning the people at large is that they
be properly armed.  -- Alexander Hamilton
-- Eric Hopper (hopper at omnifarious.org  http://www.omnifarious.org/~hopper) --
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://selenic.com/pipermail/mercurial-devel/attachments/20070609/3f954fa4/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 185 bytes
Desc: This is a digitally signed message part
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20070609/3f954fa4/attachment-0001.pgp 


More information about the Mercurial-devel mailing list