关闭Mercurial分支的最佳方法是什么? [英] What's the best way to close a Mercurial branch?

查看:91
本文介绍了关闭Mercurial分支的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最好先关闭一个分支,然后将其与默认分支合并(例如),或者先合并然后再将其关闭?

Is it better to first close a branch and then merge it with the default branch(for instance) or first merge it and then close it?

例如,在TortoiseHg中,在第一种情况下,您会看到从关闭节点到默认分支的一行.在第二种情况下,您将看到从最后一次提交到默认分支的一行,以及从最后一次提交到关闭节点的另一行.

In TortoiseHg for instance, in the first case, you'll see a line from a close node to the default branch. In the second case you'll see a line from the last commit to the default branch and an extra line from the last commit to a close node.

我希望我明白.也许只是口味问题...

I hope I'm clear. Maybe it's a matter of taste...

推荐答案

至少在任何最新版本的Mercurial中,谈论命名分支时,这两种方法之间没有真正的区别.在1.5(?)之前,情况有所不同,但是纯粹是因为hg headshg branches将在输出中包含这些闭合"分支-如果在命令上指定-c,它们仍然可以.

There is no real difference between the two methods when talking about named branches, at least in any recent version of Mercurial. Things were different pre-1.5(?), but purely in the fact that hg heads and hg branches would include these "closed" branches in their output - they still can if you specify -c on the command.

请记住,当关闭分支时(使用hg commit --close-branch或在Tortoise中),您实际上只是提交了一个新的变更集,该变更集的标志设置为表示分支X已关闭-您可以轻松地更新到该分支并重新-通过执行另一次提交将其打开.

Rememeber that when you close a branch (using hg commit --close-branch or in Tortoise) you effectively just commit a new changeset where the change has a flag set to say that branch X is closed - you can easily update to the branch and re-open it by performing another commit.

但是,当重新打开分支时,您在Tortoise中看到的栏"将仍然存在于先前关闭的变更集中,因此仅出于这个原因,我个人会选择关闭-然后-合并政策.我认为,这在视觉上更具启发性,让您看到自己正在从自己满意的事物中进行合并(并因此在合并之前关闭了分支).

However, when reopening a branch, the "bar" you see in Tortoise will still exist in the previously-closed changeset, and so for this reason alone I would personally opt for a close-then-merge policy. It is more visually instructive, I think, to see that you were merging from something you were happy with (and hence closed the branch prior to the merge).

事物与匿名"分支略有不同,因为它们合并后未包含在hg branches输出中,因此不需要显式关闭.

Things are slightly different with "anonymous" branches, in that they are not included in the hg branches output when they have been merged in, and so don't require explicit closing.

这篇关于关闭Mercurial分支的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆