Branching models (was Re: Suffering from CVS mindset)

Yawar Amin yawar.amin at gmail.com
Sun Apr 11 21:40:29 CDT 2010


On 4/11/10 8:28 PM, Greg Ward said:
> [we've drifted away from the original topic, so I've edit the subject
> and cc list]
> [...]
> But technically, that's just convention: you could
> construct a bizarre repo where a "named branch" is an arbitrary subset
> of changesets scattered throughout the graph with no topological
> consistency.
>   

You mean like this:

$ hg init branchtest
$ cd branchtest/
$ echo a >a
$ hg branch a
marked working directory as branch a
$ hg ci -m "Add a"
$ echo b >b
$ hg branch b
marked working directory as branch b
$ hg ci -m "Add b"
$ echo a2 >>a
$ hg branch a
abort: a branch of the same name already exists (use --force to override)
$ hg branch a --force
marked working directory as branch a
$ hg ci -m "Add to a"
$ hg glog -vp |less

Which results in this monster:

@  changeset:   2:0a4935f69af3
|  branch:      a
|  tag:         tip
|  user:        Yawar Amin <yawar.amin at gmail.com>
|  date:        Sun Apr 11 22:24:00 2010 -0400
|  description:
|  Add to a
|
|
|
o  changeset:   1:cdb03c133b13
|  branch:      b
|  user:        Yawar Amin <yawar.amin at gmail.com>
|  date:        Sun Apr 11 22:23:33 2010 -0400
|  description:
|  Add b
|
|
|
o  changeset:   0:0992669ee067
   branch:      a
   user:        Yawar Amin <yawar.amin at gmail.com>
   date:        Sun Apr 11 22:23:16 2010 -0400
   description:
   Add a

And apparently Mercurial can't diff the changesets. Of course, this
could be a bug (I'm using version 1.4+20091117).

I have to say I like Mercurial in general (and I love the Windows
support), but this feels kinda weird to me. Thinking in terms of
pointers is much simpler.

> This can surprise people who expect git's model of branching, because
> named branches in Mercurial last forever.  You cannot destroy them and
> you cannot rename them [1] [2].
>   

I believe I can mark a branch as closed and hide it. It doesn't really
make any sense to me to `delete' a branch--the changesets in the branch
will still be there, and I might as well keep their branch name, to more
easily group them together.

> So using Mercurial named branches in the way that git users often use
> branches -- for as a handy name for a short-lived topic branch -- is
> probably a bad idea.
>   

I have a lot of bad ideas :-)


Cheers,

 Yawar


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
URL: <http://selenic.com/pipermail/mercurial/attachments/20100411/17f9d040/attachment.pgp>


More information about the Mercurial mailing list