named branches are really confusing

Matt Mackall mpm at selenic.com
Thu Dec 27 13:40:04 CST 2007


On Thu, 2007-12-27 at 08:58 +0100, Peter Arrenbrecht wrote:
> On Dec 21, 2007 9:43 PM, Matt Mackall <mpm at selenic.com> wrote:
> > The surprise is perhaps that the branch checked out by default is, well,
> > "default".
> 
> Matt, how is this an argument against checking out the active branch
> of the cloned repo? Seems more natural to me, too. It maybe not be
> feasible or desirable for some reason, but then please say so.

You're under the mistaken impression that "active branch" is a
meaningful concept. It's not. 

There are two kinds of named branches: ones where the branch heads have
no descendents and ones where the descendents have different branch
names. We've decided to call the latter "inactive" as a hint. But just
about every time you do a merge between two named branches, one of them
will show up as "inactive", so it's really just a hint.

We could make this a bit smarter. For instance, we can find the oldest
"active" branch by the above definition and declare that any "inactive"
branch newer than that is really still at least as "active". But that's
not a whole lot smarter, really.

To do better, we'd have to come up with a scheme for -actively- marking
a branch as inactive, which will almost certainly be ugly. Or people can
just treat the hint as a hint.

The default branch is the one that gets checked out by default. Thus it
makes sense to plan your branch naming strategy with this in mind. Think
of it as "MAIN" or "TRUNK" or whatever. 

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list