简体   繁体   English

将分支与TortoiseSVN重新集成是否不需要先同步分支和中继?

[英]Doesn't reintegrating a branch with TortoiseSVN require synchronising branch and trunk first?

I thought I understood how to use the TortoiseSVN merge options. 我以为我了解如何使用TortoiseSVN合并选项。 I thought that if you hadn't updated from trunk since the branch was created you could use merge a range of revisions, but if you had updated branch from trunk at some point then you had to synchronise branch and trunk then use either reintegrate a branch (or merge two different trees). 我以为,如果自创建分支以来尚未从主干更新,则可以使用合并一系列修订,但是如果某个时候从主干更新了分支,则必须同步分支和主干,然后使用重新集成分支(或合并两个不同的树)。

I also thought the corollary was that if you hadn't updated branch from trunk and you tried to use reintegrate a branch then you would lose changes to trunk since the branch was created - that is, if you didn't want to synchronise the two then you had to use merge a range of revisions. 我还认为,必然的结果是,如果您没有从主干更新分支,并且尝试使用重新集成分支,那么自从创建分支以来,您将丢失对主干的更改-也就是说,如果您不想使两者同步那么您必须使用合并一系列修订。

However a colleague of mine says he uses reintegrate a branch in all cirstumstances without losing anything. 但是,我的一位同事说,他在所有情况下都使用分支机构重新整合而不会丢失任何东西。 So I've run a few tests, and I have to agree that you don't appear to lose changes to trunk committed after the creation of the branch when you merge using TortoiseSVN 'reintegrate a branch' from the branch to the working copy of trunk, even if you haven't merged the trunk revisions into your branch first. 因此,我已经进行了一些测试,我必须同意,当您使用TortoiseSVN合并从分支到分支的工作副本时,合并分支创建后似乎不会丢失对提交的主干所做的更改。即使您没有先将主干版本合并到分支中,也可以使用主干。 Is this right? 这是正确的吗? What is the explanation for the advice in the manual then? 那么手册中建议的解释是什么?

In the TortoiseSVN documentation , in the part about the "Reintegrate a branch" merge option, it says: 在TortoiseSVN 文档中 ,有关“重新集成分支”合并选项的部分中说:

All trunk changes have been ported to the feature branch, week by week, and now the feature is complete you want to merge it back into the trunk. 所有主干更改已逐周移植到功能分支,现在该功能已完成,您想将其合并回主干。 Because you have kept the feature branch synchronized with the trunk, the latest versions of branch and trunk will be absolutely identical except for your branch changes 由于您已使功能分支与主干保持同步,因此分支和主干的最新版本将完全相同,除了分支更改之外

I believe this is the part that is causing the confusion (it confused me for a while too), but then it says: 我认为这是造成混乱的部分(它也使我困惑了一阵子),但随后它说:

It uses the merge-tracking features of Subversion to calculate the correct revision ranges to use, and perform additional checks which ensure that the branch has been fully updated with trunk changes. 它使用Subversion的合并跟踪功能来计算要使用的正确修订范围,并执行其他检查以确保分支已通过干线更改进行了完全更新。 This ensures that you don't accidentally undo work that others have committed to trunk since you last synchronized changes. 这样可以确保您不会意外撤消自您上次同步更改以来其他人已承诺进行中继的工作。

Based on this second snippet from the document, and my own experience, I believe it is safe to use the "reintegrate a branch" merge option. 根据文档中的第二个片段以及我的经验,我相信使用“重新集成分支”合并选项是安全的。 We use this method for reintegrating our branches, and our branches are very rarely updated with trunk changes (only if a fix in the trunk fixes a blocking issue in the branch). 我们使用这种方法来重新集成分支,并且很少会通过更改主干来更新分支(仅当主干中的修复解决了分支中的阻塞问题时)。

For updating our branches with trunk changes, we always use "merge a range of revisions". 为了通过主干更改来更新分支,我们始终使用“合并一系列修订”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM