Bookmarks - Tutorial / Git comparison

Martin Geisler mg at aragost.com
Tue Jul 13 08:26:18 UTC 2010


François Gannaz <francois.gannaz at free.fr> writes:

I'm sending this back on the mailinglist -- please remember to send your
reply there as well.

>> The Definitive Guide to Mercurial promotes this way of working, but
>> it is not your only option. It is important to realize that Mercurial
>> has always supported *multiple light-weight branches* within a single
>> repository.
>> 
>> Many blog posts describe this as a Git-only feature and fail to
>> realize that Mercurial supports it too.
>
> The first post requested "branches that can be also removed without
> traces". Do you mean that can be done within a single Mercurial
> repository, with no extension? Please explain me how or point me to
> some reference.

Mercurial lets you build your history graph in whatever shape you like.
When you have a graph, you can use 'hg clone -r R' to obtain the subset
of the graph that lead to revision R.

This can be used to remove a feature branch by cloning the other heads:
you can repeat the -r option as needed or you can use 'hg pull -r'
afterwards to bring in the changesets you want.


Whether it is practical to remove a branch does not depend on whether
you use clones or not. Clones can always be combined into single
repository, and such a combined repository can be split into separate
clones again.

Removing a branch only depends on how widely it has been published. When
using clones, you can delete the clones and ask others to do the same,
when using in-repository light-weight branches, you can ask people to
clone away the unneeded heads.

Deleting a clone is of course considered much easier than deleting a
head and the error message people get when they try to continue work on
a deleted branch is different -- when you delete a central clone they
are told

  abort: no suitable response from remote hg!

whereas they are merely told that

  abort: push creates new remote heads!

if their branch has disappeared from the central repository.

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://aragost.com/mercurial/



More information about the Mercurial mailing list