TFS 合并不选择回滚变更集 [英] TFS merge doesn't pick up rollback changeset(s)

查看:15
本文介绍了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.

现在的问题是:从新分支到主分支的合并中应该包含哪些变更集?从逻辑上讲,它应该是:[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 分支合并回主分支时,它确实将回滚更改 (CS6) 带回了源/主分支.

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:工作区>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 中.

  • In July, you make several changes $/BranchA/Util.cs. These changes are encompassed in changesets 297, 301, and 305.

2009 年 8 月 1 日,您将 $/BranchA/Util.cs 合并到 $/BranchB/Util.cs:

On August 1, 2009, you merge $/BranchA/Util.cs to $/BranchB/Util.cs:

c:工作区>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.

  • 一周后,您意识到您所做的编辑7 月的 $/BranchA/Util.cs 不适用于 $/BranchB/Util.cs.您可以使用 rollback 命令来否定这些更改.当你使用 rollback 命令回滚合并更改或分支改变,你必须做出决定.

  • 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.

如果您希望将 7 月份对 $/BranchA/Util.cs 所做的更改更改为在以后的合并中重新应用于 $/BranchB/Util.cs,您应该输入以下命令:

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:工作区>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:工作区>tf 合并 $/BranchA $/BranchB

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

如果省略/keepmergehistory 选项,合并更改将应用于 $/BranchB/Util.cs 所有已应用于的变更集$/BranchA/Util.cs 自变更集 292 起,包括变更集 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 所有已应用于的变更集$/BranchA/Util.cs 自变更集 292 起,不包括变更集 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天全站免登陆