我将Mercurial与命名分支一起使用,请注意,当我创建默认的新分支时,default被标记为非活动分支。例如:

C:\data\solutions\test-repo>hg branches
default                        0:aeec280e6310

C:\data\solutions\test-repo>hg branch feature-branch
marked working directory as branch feature-branch

C:\data\solutions\test-repo>hg com -m "created new branch"

C:\data\solutions\test-repo>hg branches
feature-branch                 1:1cb18d7fa554
default                        0:aeec280e6310 (inactive)


这是一个问题,因为我们的部署系统显示了可以从中部署的活动的命名分支。

如何使我的默认分支保持“活动”状态?

最佳答案

“活动”和“不活动”分支的概念是我们在Mercurial项目中逐渐摆脱的。问题很简单,正如您所看到的,分支可以在不方便的时间或多或少地在两个状态之间来回翻转。

相反,我们现在专注于“开放”与“封闭”。这是一个明确的概念:要关闭分支头,您需要

$ hg update feature-branch
$ hg commit --close-branch -m "passes all tests, ready for merging"


这将添加一个特殊的变更集,该变更集将分支头标记为关闭。当分支上的所有头均关闭时,该分支本身被视为已关闭,并且将从hg branches中消失。我建议在合并之前关闭,请see my named branch guide for a longer example

因此,我建议您将部署系统更改为显示打开的分支(hg branches)而不是活动分支(hg branches --active)。

09-04 05:47
查看更多