Questions about branching in Mercurial

Sebastien Lucas sebastien.lucas at gmail.com
Sun May 6 11:38:38 CDT 2007


On 5/6/07, Aurelien Jacobs <aurel at gnuage.org> wrote:
> On Sun, 6 May 2007 10:24:27 +0200
> "Sebastien Lucas" <sebastien.lucas at gmail.com> wrote:
>
> > On 5/6/07, Matt Mackall <mpm at selenic.com> wrote:
> > > On Sun, May 06, 2007 at 11:30:04AM +1000, Tim Allen wrote:
> > > > > There are currently some discussions about strange effects when merging
> > > > > two named branches on the mailinglist, so in your case I would consider to
> > > > > subscribe to the list.
> > > >
> > > > I've been checking the mail archive at http://marc.info/ since it was
> > > > recommended on the Mercurial wiki, and sadly it doesn't have that thread
> > > > yet. The Mailman archives at selenic.com do record it, and gmane does as
> > > > well, so I guess I'll be using gmane in future.
> > > >
> > > > That thread pretty much answers my questions (the consensus seems to be
> > > > that named branches aren't useful yet) so I guess I'm done.
> > >
> > > They've still got a couple rough edges that should be polished up in
> > > the next couple months, but I think they're perfectly useful today
> > > provided you understand how they work.
> >
> > I don't know if the goal is that named branches and "cloned" branches
> > have the same functionnalities. By now it's not the case.
>
> It is the case.
>
> > If I have a repo with one head (master) and I clone it to make a new
> > branch (dev-branch) then I'll a have two repo with one head in each
> > repo. assuming I do not touch master and I add some changeset in
> > dev-branch I can push my change from dev-branch to master
>
> Up to there, you're right.
>
> > and merge them.
>
> Here you're wrong ! There is nothing to merge at that point.

That's where we disagree.

> > Now if I do the same with named branches I'll have to commit a dummy
> > changeset on master so that my repository has two heads and I can
> > merge (See this thread for more detail :
> > http://article.gmane.org/gmane.comp.version-control.mercurial.general/1352)
>
> I think you misunderstood something. Here are the 2 key points:
>  - hg branch *don't* create a branch ! It only give a name to the current
>    branch.

I agree named branches are not real branch (as in CVS, SVN or perhaps
other SCM).

>  - the only way to create a real branch (named or not) is to commit
>    over an older (non-tip) revision. As long as you commit (or push)
>    over tip, you can't create a branch.

Completely agree. I understand I need a dummy changeset to have 2
heads (one for each branch).

>
> In your original example, you just had a single branch with 2 names
> (default and dev).

Again I agree. I perfectly understand your point and I think I
understand how mercurial works. The way named branch where added
didn't change the internal of mercurial, it was just a cosmetic
change.

My point is just that it's extremely disconcerting when coming from CVS or SVN.

That's all my point, I still think mercurial is great but that part
should be explained more precisely (I'll try to find some time to
update the wiki).


More information about the Mercurial mailing list