Branches in general

Matt Mackall mpm at selenic.com
Sun Jun 10 14:45:36 CDT 2007


On Sun, Jun 10, 2007 at 07:41:05AM -0700, Eric M. Hopper wrote:
> On Sat, 2007-06-09 at 16:27 -0500, Matt Mackall wrote:
> 
> > > > > 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.
> > > > 
> > > > In some sense it's artificial, yes. No files are touched, etc. In some
> > > > sense it's not: declaring that the changes in B3 are now part of
> > > > branch A is an event. It has a time, it has an associated user, and it
> > > > may have a non-trivial description.
> > > 
> > > Usually I don't want to know this.  I can see some cases in which it's
> > > an event worthy of the world knowing about, but mostly I don't think it
> > > is.
> > 
> > 
> > You don't want to know this.. *ever*? The alternative that people are
> > proposing is -no history-.
> 
> I think I don't agree with the no history approach after some thought.
> But I also think that not every branch merge is deserving of being
> recorded in the history.  I think this will clutter the history and may
> result in poor decisions by both humans and algorithms.

I am in favor of making it "fast-forward" merges invisible to log with
-M. Back to the question of what this does to the ancestor algorithm:

A1-A2-A3----------A4
        \        / 
         B4-B5-B6  

Turns out the "depth" of A4 is not A3's depth plus one but
max(depth(A3), depth(B6)) + 1. Which makes sense: you can't be "born"
before your parents.

(If you look at the code, this is confusing:

                depth[vertex] = min([depth[p] for p in pl]) - 1

We actually calculate negative depths so that things work nicely with
Python's heap implementation!)

So I think we can just go ahead and store both parents A3 and B6 for a
fast-forward merge. Then it's a real merge again and -M just works.

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial-devel mailing list