views:

44

answers:

2

is the proper way to

hg up bugfix                # <-- use that branch
hg commit --close-branch
hg up another_branch        # <-- use another branch
hg commit --close-branch
hg up default

and now hg heads will only show 1 head? Is this the proper way to close unused branches?

Looks like if we hg up bugfix again and change some file and commit, then that branch will automatically be re-opened and the default branch will show 2 heads again?

+3  A: 

Is this the proper way to close unused branches?

Correct. You can also use hg heads -c to show all branches.

Looks like if we hg up bugfix again and change some file and commit, then that branch will automatically be re-opened and the default branch will show 2 heads again?

Also correct. Newer versions of Mercurial will issue an information message about "reopening closed branch".

Niall C.
A: 

While this is the proper way to close unused branches, do realize that you generally shouldn't be closing named branches in the mercurial branching model.

Generally speaking, small "feature branches" should be implemented either as anonymous branches or cloned repositories in mercurial.

Named branches are really designed for a different usecase, the case in which you would never close them. "Named branches are forever", and are a decent way of tracking bug-fix releases to code that has been released to the public. At my company, named branches typically only have a handful of commits after branching, and it's always bugfixes that are serious (think security or major data-integrity issues)

jkerian