I've noticed that some answers to questions about branch names quote the Mercurial wiki to indicate that the branch-per-feature or branch-per-bug naming conventions may cause performance problems.
Does the ability to mark branches as closed with the --close-branch
flag on commits have any effect on this performance claim?
Does the ability to mark branches as closed with the
--close-branch
flag on commits have any affect on this performance claim?
Marking a branch closed with hg commit --close-branch
merely creates a new changeset with a close=1
marker in the changeset meta data. Commands like hg branches
and hg heads
will then know not to show this branch/head. These commands use a branch cache to speed things up and we expect that cache to scale well with the number of branches.
However, there are some operations that have a complexity that is linear in the number of topological heads. This includes the discovery protocol used before version 1.9. The new discovery protocol in version 1.9 will still exchange topological heads in its "samples", but the sample size is capped at 200 changesets.
There might be other code paths that still scale linearly in the number of heads and this is why we suggest close-before-merge:
$ hg update bug-123
$ hg commit --close-branch -m "All fixed"
$ hg update default
$ hg merge bug-123
instead merge-before-close:
$ hg update default
$ hg merge bug-123
$ hg update bug-123
$ hg commit --close-branch -m "All fixed"
The latter approach leaves a dangling head in the graph (a topological head).