汞储存库的“默认"分支应包含哪些内容? [英] What should go in the 'default' branch of a Hg repository?
问题描述
在使用Mercurial或类似DVCS工具进行版本控制的大型Libre Source软件项目中,以下哪个被认为是更常规的:
In large Libre Source software projects, versioned with Mercurial or similar DVCS tools, which of the following is considered to be more conventional:
- 在
default
分支中保留该软件的最新稳定"版本.在default
中标记每个发行版,以便您知道哪个修订版本打包下载.一旦测试将修补程序合并到default
中.在命名分支中保留新功能等,以在下一个版本中合并到default
中. - 将每个发行版保留在命名分支或类似分支中.使用
default
保留仅由开发人员或功能强大的人运行的尖端代码.
- Keeping the latest "stable" version of the software in the
default
branch. Tagging each release indefault
so you know which revision got packaged up as a download. Merging patches intodefault
as soon as they are tested. Keeping new features, etc. in named branches to be merged intodefault
on the next release. - Keeping each release in a named branch, or similar. Using
default
to keep bleeding-edge code that's only intended to be run by developers or the very foolhardy.
或者...是否有一些更好的工作流程模式被广泛接受?
Or... is there some better pattern of workflow that it widely accepted?
推荐答案
Mercurial对您应使用default
分支的用途有相当强烈的意见.它记录在标准分支维基页面中.摘要是:
Mercurial has a fairly strong opinion on what you should use your default
branch for. It's documented in the Standard Branching wiki page. The summary is:
-
您的主要开发分支不应使用
default
以外的名称.
原因是default
是新克隆检出的分支.如果您尝试在主"分支中使用其他名称,那么当用户在错误的位置克隆并提交内容时,用户将获得或多或少的随机分支,这通常是不可取的.
The reason is that default
is the branch that is checked out by new clones. If you try to use some other name for your "main" branch, users will get a more or less random branch when they clone and commit things in the wrong place, which is generally undesirable.
即使有大量说明添加新功能之前分支"的文档(请参阅下一点),人们在向您发送补丁时也会忘记这一点.这样一来,他们便无法通过移动变更集来清理事物.
Even with tons of documentation that says "branch before adding a new feature" (see next point), people will forget this when they send you patches. They then have the trouble of cleaning up things by moving changesets around.
因此,始终将尖端代码放在default
分支中,并使用其他分支来稳定发行.
So always put the bleeding-edge code in the default
branch and use other branches for your stable releases.
不要将分支名称视为一次性使用
Don't treat branch names as disposable
分支名称是每个提交的永久部分,并允许标识每个提交在哪个分支上引入.因此,您将需要对分支名称进行一些考虑,以免污染分支名称空间.
Branch names are a permanent part of each commit and allow identifying on which branch each commit was introduced. Thus you will want to give some thought to your branch names so that you don't pollute the branch namespace.
此外,如果您尝试通过每个错误修正使用一个分支,则最终可能会遇到性能问题. Mercurial及其周围的工具旨在与数百个分支机构协同工作. Mercurial本身在1万个分支中仍然可以很好地工作,但是某些命令可能会显示出明显的开销,只有在工作流异常稳定之后,您才会看到这些开销.
Also, if you attempt to use a branch per bugfix, you may eventually run into performance issues. Mercurial and the tools surrounding it are designed to work well with hundreds of branches. Mercurial itself still works quite well with ten thousand branches, but some commands might show noticeable overhead which you will only see after your workflow alredy stabilized.
我们在Mercurial内部建立了缓存,因此问题主要是UI问题:托管网站和日志查看器可能会运行hg branches
,以将所有10,000个分支加载到一个下拉菜单中.对于想要从巨大菜单中选择单个分支的可怜用户来说,这确实是缓慢且无用的.
We have caches in place internally in Mercurial, so the problems are mostly UI problems: hosting sites and log viewers might run hg branches
to load all 10,000 branches into a single drop-down menu. That is really slow and useless for the poor user that want to select a single branch from the gigantic menu.
如果分支是关闭的,则它们将不会出现在hg branches
中,因此应将问题最小化.但是,这些工具也可能希望显示封闭的分支-都取决于该工具.
If the branches are closed, then they wont show up in hg branches
, and so the problem should be minimized. However, the tools might want to show closed branches too — it all depends on the tool.
对不起,这有点含糊.要点是,Mercurial的构建是为了扩展变更集的数量,而不是命名分支的数量.我们已经用前面提到的缓存解决了命名分支的最大性能问题,所以今天我不必太担心有很多分支,尤其是如果打开的分支的数量保持较小(少于100个)的话. /p>
I'm sorry this is a little vague. The main point is that Mercurial is built to scale in the number of changesets, not the number of named branches. We have addressed the biggest performance problems with named branches with the cache I mentioned before, so today I'm not too concerned about having many branches, especially if the number of open branches is kept small (less than, say, 100).
这篇关于汞储存库的“默认"分支应包含哪些内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!