"hg branches"

Brendan Cully brendan at kublai.com
Sat Jun 9 11:11:30 CDT 2007


On Saturday, 09 June 2007 at 00:08, Daniel Holth wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> The current Mercurial "hg branches" feature, imo, is a horrible
> misfeature the proper use of which was never understood by anyone at
> all. That is because the feature as implemented is properly left unused.
> 
> Once you have the misfortune to try to use the current "hg branches"
> feature, which is a way of giving a special kind of tag to individual
> revisions, you find it is completely unintuitive. For starters, "hg
> branch x" does not create a branch, "hg update -r branch-name" is

hg branch might want a flag to create the branch immediately via empty
commit, I guess.

> terribly unlikely to do the right thing, there is no way to

what's the right thing, and what does it do?

> distinguish when one branch ends and another branch begins (did I mean
> to close development on trunk? or do I intend to work on that revision
> AND the 15 branch-foo revisions on top of it? how do I have a branch
> tip for revisions that were already released, and distinguish that
> from the revisions that were not released yet?)... after a few weeks,
> when you have 36 branches as we do at my workplace, but none of them
> mean anything, you will realize it was all a mistake and try to forget
> about "hg branches" altogether.
> 
> The branch mechanism is convenient for marking which SVN branch a
> particular revision came from in the converted history, but otherwise
> it is not very useful. There is virtually no chance that a developer
> will correctly start their branch as a child of "the revision that's
> currently deployed" as would be most convenient if we wish to use

Let's see... by this I think you mean the tip of the default
branch. Very recently hg was fixed so that clone would update to the
latest rev on 'default' instead of the repo-wide tip. For some time
update and pull -u have also updated to the latest revision of the
branch currently checked out, so that should help here too. Probably
hg log/incoming/outgoing could use similar logic to hide other
branches. Hg has also recently adopted a url#branch syntax so that you
can clone http://server/repo#stable, then push and pull to that
branch.

It looks like this new code should help with your situation. As far as
I can tell, what's missing is a way to filter branches from log, and
probably some way to mark a branch as inactive to avoid cluttering up
the branch list. Eric has some code to do that, currently under review.


More information about the Mercurial-devel mailing list