tags:

views:

66

answers:

1

When using hg branch FeatureBranchName and publishing it to a central repo that is shared amongst developers, is there a way to eventually close the FeatureBranchName when its development has officially been merged with the default branch?

It would also be helpful if the FeatureBranchName was not visible when performing a hg branches command.

+5  A: 
hg commit --close-branch

should be enough to mark a branch close. (see hg commit)

--close-branch

mark a branch as closed, hiding it from the branch list.

See also this thread:

My expectation is that I close a branch because this line of development has come to a dead end, and I don't want to be bothered with it any more.
Therefore, when a branch has been closed I shouldn't see it (in branches, heads, log, for instance) unless I explicitly ask to see closed branches.

I should note that I expect a closed branch to remain in the repository; it may be useful in the future, and the commit --close-branch message should at least explain why the branch was closed.
Pruning branches is another thing altogether.


Note: that "closing branch" business is one aspect seen as missing in Git, when compared to Mercurial:

Branches in git are, we’re always told, ephemeral things to be used and thrown away, and so far as I know git doesn’t have a way to indicate to your colleagues that you’re done with a branch;
the only way to do this is to delete it, or to hope they see the final merge commit and understand that the branch is closed to further development.

[In Mercurial] When you’re done with a branch, however, you cannot delete it from the repository; instead, you issue a commit which closes the branch, and Mercurial notes that the branch is closed. It’ll remain a permanent part of your repository history.

VonC
plus a few other options http://mercurial.selenic.com/wiki/PruningDeadBranches
Rup