TFS合并不会获取回滚更改集 [英] TFS merge doesn't pick up rollback changeset(s)

查看:59
本文介绍了TFS合并不会获取回滚更改集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了以下TFS问题:

I've had the following TFS issue:

我已经从MAIN分支创建了新分支.在这段时间内,新分支上发生了一些变更集(让它们从CS-1到CS-2指定). 片刻之后,我对MAIN分支进行了修改,并且此修改已合并到新分支上(分支上的新变更集:CS-3).

I've created the new branch from MAIN branch. During the time some changesets (let specify them from CS-1 to CS-2) have happened on the new branch. In one moment I had modification on MAIN branch and this modification has been merged on the new branch (new changeset on branch: CS-3).

此后,新分支进行了几次更改(产生了从CS-4到CS-5的变更集).另外,我回滚了CS-3,结果在新分支上创建了新的变更集CS-6.

After that, new branch was having several changes (which produced changesets from CS-4 to CS-5). Also, I did a rollback of CS-3 and as result the new changeset CS-6 has been created on the new branch.

现在,问题是: 从新分支到MAIN的合并中应包含哪些变更集? 从逻辑上讲,它应该是:[CS-1 – CS-2,CS-4 – CS-5和CS-6]. 但是,实际结果是:[CS-1 – CS-2,CS-4 – CS-5]

Now, the question is: Which changesets should be contained in merge from the new branch back to the MAIN? Logically, it should be: [CS-1 – CS-2, CS-4 – CS-5 and CS-6]. But, the real result was: [CS-1 – CS-2, CS-4 – CS-5]

有人有什么主意:为什么合并中不包含回滚变更集(CS-6)? 显而易见,变更集CS-6的回滚与常规变更集没有得到同等对待.

Does anybody have any idea: Why the rollback changeset (CS-6) is not contained in merge? It is obvious that rollback of changeset CS-6 is not treated equally as usual changeset.

推荐答案

首先,很好解释的问题:).您需要开始使用的选项是"

First of all, very well explained question :). The option which you need to start using is the "

tf回滚/keepmergehistory

tf rollback /keepmergehistory

以下示例说明了执行回滚时可以使用的2个不同选项,以及为什么会出现上述特定行为.我重新创建了上面提到的整个方案,但是我使用

The following example explains the 2 different options that we can use while doing rollbacks, and why you got the specific behavior you mentioned above. I recreated the entire scenario you mentioned above, but I rolled back from command prompt using the

/keepmergehistory

/keepmergehistory

这一次,当我尝试从dev分支合并回Main分支时,确实将回滚的更改(CS6)带回到了source/main分支.

This time when I tried to merge back from dev branch back to the Main branch, it did bring up the rolled-back change (CS6) back to the source/main branch.

来自MSDN的解释:

回滚包括分支或合并更改的变更集时,通常希望将来在同一源和同一目标之间进行合并以包括这些更改.但是,如果希望将来在同一源和同一目标之间进行合并以排除过去合并操作中包含的变更集,则可以使用/keepmergehistory选项.

When you roll back a changeset that includes a branch or a merge change, you usually want future merges between the same source and the same target to include those changes. However, you can use the /keepmergehistory option if you want future merges between the same source and the same target to exclude changesets that were encompassed in a past merge operation.

例如,您可以在以下情况下使用此命令:

For example, you can use this command in the following situation:

  • 在2009年6月30日,您对来自 $/BranchA/至$/BranchB/:

  • In On June 30, 2009, you perform a full merge of all items from $/BranchA/ to $/BranchB/:

c:\ workspace> tf合并$/BranchA $/BranchB

c:\workspace> tf merge $/BranchA $/BranchB

您将此次合并作为变更集292的一部分签入.

You check in this merge as part of changeset 292.

  • 7月,您对$/BranchA/Util.cs进行了一些更改.这些变化 包含在变更集297、301和305中.
  • 2009年8月1日,您将$/BranchA/Util.cs合并到$/BranchB/Util.cs:

  • In July, you make several changes $/BranchA/Util.cs. These changes are encompassed in changesets 297, 301, and 305.
  • On August 1, 2009, you merge $/BranchA/Util.cs to $/BranchB/Util.cs:

c:\ workspace> tf合并$/BranchA/Util.cs $/BranchB/Util.cs

c:\workspace> tf merge $/BranchA/Util.cs $/BranchB/Util.cs

您将更改作为更改集314的一部分签入.此操作的结果是,您在更改集297、301和305中对$/BranchA/Util.cs所做的编辑现在也应用于$/BranchB. /Util.cs.

You check in the change as part of changeset 314. The result of this operation is that the edits that you made in changesets 297, 301, and 305 to $/BranchA/Util.cs are now also applied to $/BranchB/Util.cs.

  • 一周后,您意识到您对 七月份的$/BranchA/Util.cs不适合$/BranchB/Util.cs. 您可以使用rollback命令来取消这些更改.当你 使用rollback命令回滚合并更改或分支 更改,您有决定权.
  • 如果要将7月份对$/BranchA/Util.cs所做的更改 在将来的合并中重新应用到$/BranchB/Util.cs时,您应该输入 以下命令:

  • A week later, you realize that the edits that you made to $/BranchA/Util.cs in July are not appropriate for $/BranchB/Util.cs. You can use the rollback command to negate these changes. When you use the rollback command to roll back a merge change or a branch change, you have a decision to make.
  • If you want the changes that you made in July to $/BranchA/Util.cs to be re-applied to $/BranchB/Util.cs in future merges, you should type the following command:

c:\ workspace> tf回滚/changeset:314

c:\workspace> tf rollback /changeset:314

如果要将7月份对$/BranchA/Util.cs所做的更改 永远不要在以后的合并中重新应用到$/BranchB/Util.cs,您应该 键入以下命令:

If you want the changes that you made in July to $/BranchA/Util.cs to never be re-applied to $/BranchB/Util.cs in future merges, you should type the following command:

c:\ workspace> tf回滚/changeset:314/keepmergehistory

c:\workspace> tf rollback /changeset:314 /keepmergehistory

几周后,您将$/BranchA/合并为$/BranchB/: c:\ workspace> tf merge $/BranchA $/BranchB

A few weeks later, you merge $/BranchA/ into $/BranchB/: c:\workspace> tf merge $/BranchA $/BranchB

如果您省略了/keepmergehistory选项,则合并更改将 将适用于$/BranchB/Util.cs的所有变更集应用于 更改集292之后的$/BranchA/Util.cs,包括更改集297、301和

If you omitted the /keepmergehistory option, the merge change will apply to $/BranchB/Util.cs all changesets that were applied to $/BranchA/Util.cs since changeset 292, including changesets 297, 301,

换句话说,将来的合并将撤消回滚更改.

In other words, a future merge will undo the rollback change.

如果包含/keepmergehistory选项,则合并操作 将应用于$/BranchB/Util.cs的所有变更集 自更改集292起的$/BranchA/Util.cs,不包括更改集297、301, 和305.换句话说,将来的合并不会撤消回滚 改变.因此,BranchA上的内容可能与内容不匹配 在BranchB上.

If you included the /keepmergehistory option, the merge operation will apply to $/BranchB/Util.cs all changesets that were applied to $/BranchA/Util.cs since changeset 292, excluding changesets 297, 301, and 305. In other words, a future merge will not undo the rollback change. Therefore, the content on BranchA might not match the content on BranchB.

MSDN来源

这篇关于TFS合并不会获取回滚更改集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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