What exactly *is* a branch?

Steve Losh steve at stevelosh.com
Wed Jun 23 17:45:03 UTC 2010


On Jun 23, 2010, at 1:27 PM, Daniel Carrera wrote:

> Ok, I've read this page. But it didn't quite give me what I want, but
> I am ready to form a hypothesis:
> 
> _Hypothesis_:  A (non-light) branch is the same as a light branch,
> except that the commit metadata (author, date, etc) has a new field
> "branch" with the branch name. In this way, the name becomes an
> irremovable part of history.

Correct.

> 
> The problem with that hypothesis is that it doesn't explain how
> Mercurial keeps track of a different "tip" for each branch. It does,
> however, explain how you would switch between named branches:

"hg help glossary" says:

    Branch, named
        A collection of changesets which have the same branch name. ...
    ...
    Tip, branch
        The head of a given branch with the highest revision number. ...

So a branch tip is the highest-numbered head of a branch.

> 
> 1) Get a list of heads (i.e. a changeset without children).
> 2) Look up the ones that have the "branch" field set.
> 
> Btw, I notice that the author of this page did not realize that
> "clones" and "anonymous branches" are fundamentally the same thing.

The post is about branching models and workflows.  Underneath it all they're
the same, but in practice *working* with them is very different, so they're organized
into separate sections.

There's also the part in the comments where I said:

> In this post I talked about Mercurial's different "branching models," but the more
> I think on it the more I think that that term isn't 100% accurate.
> 
> There really is just one branching model in Mercurial: anonymous branching.

So yes, I understand it, but for a practical, real-world guide they're two different ways
of working with Mercurial's branching so each one gets its own section.

> 
> Daniel.
> 
> On Wed, Jun 23, 2010 at 6:36 PM, rupert.thurner
> <rupert.thurner at gmail.com> wrote:
>> maybe http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial
>> helps a little ...
> 
> 
> -- 
> No trees were killed in the generation of this message. A large number
> of electrons were, however, severely inconvenienced.
> _______________________________________________
> Mercurial mailing list
> Mercurial at selenic.com
> http://selenic.com/mailman/listinfo/mercurial




More information about the Mercurial mailing list