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 affect on this performance claim?
相关问题
- Correct procedure to use pending branch changes in
- Mercurial compared to private branches in SVN
- How to abandon all Mercurial changes that haven
- Windows permissions on a directory: Mercurial - hg
- hg shelve installed but hg: unknown command 'u
相关文章
- Mercurial Commit Charts / Graphs [closed]
- What is the tortoisehg gui equivalent of doing “hg
- How to use Mercurial from Visual Studio 2010?
- Is there a version control system abstraction for
- Tag multiple branches in git?
- Mercurial discard local changes of a file or group
- Mercurial .hgignore Negative Lookahead
- Switch node_modules folder when I change git branc
Close branch probably won't make any difference in performance, but that's not the point. The performance implications are small, and certainly not the reason I suggested you avoid permanent branch names for short-lived lines of development. Here's the relevant quote from the wiki:
The reason both MG and I (we're the primary answerers in both of your linked questions) is because time and time again we watch people get really annoyed when they learn that branch names are permanent in Mercurial. Here's the usual exchange, that acts itself out in IRC a few times a week:
or similarly:
If you want permanent, forever branch names on your changes (and MG, my co-answerer on both of those questions does like exactly that) then by all means use them, and don't worry a bit about performance. But do worry about how your tools represent the branches: like Mercurial itself, tools are typically built to scale in the number of changesets, not the number of branches. So they often do naive things like putting all branch names into a single drop-down menu. This GUI problem will eventually be fixed when named branches become more popular.
Steve Losh's excellent Guide to Branching in Mercurial does a great job spelling out your (four!) options. Pick what you like and be confident there are plenty of folks who like whichever one you selected, and at least a few of them have more branches than you ever will.
Marking a branch closed with
hg commit --close-branch
merely creates a new changeset with aclose=1
marker in the changeset meta data. Commands likehg branches
andhg 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:
instead merge-before-close:
The latter approach leaves a dangling head in the graph (a topological head).