我们有一个TFS2010主干和几个分支。
我试图将 trunk 和branch1 带到这样的状态:从 trunk 合并到branch1,签入,然后从branch1 合并到trunk 并签入,不再有任何更改。
但是,在那之后,如果我尝试查看是否有仍然有任何可能合并的方式,TFS 不断向我显示同一组大约 15 个需要合并的文件。执行合并后,在文件系统上找不到文件,但 TFS 仍然确定这 15 个文件将被合并。
我多次循环地将一个合并到另一个中,反之亦然,但似乎没有什么可以解决它。我并不是我们团队中第一个遇到此错误/功能的人。
也许我错过了一些明显的东西?有人知道为什么 TFS 的行为如此奇怪吗?有没有办法结束这种无休无止、毫无意义的合并的无政府状态?
We have a TFS2010 main trunk and several branches.
I am trying to bring trunk and branch1 to a state when there are no more changes left by merging from trunk to branch1, checking in and then merging from branch1 to trunk and checking in.
However, after that if I try to see if there is still anything possible to merge either way TFS keeps on showing me the same set of about 15 files that require merging. After merge is performed the files are nowhere to find on the file system, but TFS is still sure these 15 files are to be merged.
I went in cycles many times merging one into the other and vice-versa but nothing seem to fix it. And I am not the first one in our team to experience this bug/feature.
May be I am missing something obvious? Anyone any ideas why TFS is behaving so weirdly? Is there a way to put an end to this anarchy of endless pointless merges?
发布评论
评论(3)
这是杰森强调的精彩简报之外可能出现的一种情况。
您之前是否对 main 或branch1 中的变更集使用过 tf.exe rollback /keepmergehistory[1] 命令?在此处阅读有关 tf.exe 回滚命令的更多信息 http://geekswithblogs.net/TarunArora/archive/2011/06/27/how-to-undo-a-changeset-using-tf.exe-rollback.aspx
[1] - 如果您希望将来在同一源和同一目标之间进行合并以排除要回滚的更改,请指定此选项。
如果是这样,您可以使用 tf.exe merge /force http://msdn.microsoft.com/en-us/library/bd6dxhfy(v=VS.100).aspx 强制两个分支之间进行合并。但请确保在合并后签入(当合并后出现冲突时,除非您解决冲突并签入,否则更改将保持签出状态),并且如果您在合并到分支后查看历史记录,则可以查看新的变更集,验证变更集详细信息以确保合并正确进行。
The one case that is possible outside the wonderful brief that Jason has highlighted.
Have you previously used the tf.exe rollback /keepmergehistory[1] command on the changesets in the main or branch1? Read more about the tf.exe rollback command here http://geekswithblogs.net/TarunArora/archive/2011/06/27/how-to-undo-a-changeset-using-tf.exe-rollback.aspx
[1] - Specify this option if you want future merges between the same source and the same target to exclude the changes that you are rolling back.
If so, you can use tf.exe merge /force http://msdn.microsoft.com/en-us/library/bd6dxhfy(v=VS.100).aspx which forces a merge between the 2 branches. But make sure you check in after the merge (when there is conflict after the merge, unless you resolve the conflict and check in, the changes remain checked out) and if you do a view history after the merge to the branch you are able to see the new changeset, verify the changeset details to make sure that the merge took place correctly.
当您更改两个分支中的文件并来回合并时,TFS 并不总是(我仍然没有找到何时以及为什么)更新文件的共同祖先,使其认为它们仍然都已更改。
为了纠正这个问题,一旦我知道源分支和目标分支已经相同,我总是执行合并并为冲突选择“获取源分支”。
如果有人有一个很好的解释为什么会发生这种情况,我会很高兴听到......
When you've changed the file in both branches and merge back and forth, TFS does not always (I still haven't found out when and why) update the common ancestor for the files making it think they are still both changed.
To correct this issue I always just perform a merge and choose "Take source branch" for the conflicts, once I know that source and destination branches are already the same.
If anyone has a good explanation why this happens I'd be happy to hear it...
我可以想到几种可能性:
1)(请原谅我,如果它陈述的是显而易见的)当您合并时,更改是在您的工作区本地进行的,并且不会提交到 TFS 数据库。合并完成后,您需要签入更改,然后它们才会反映在 TFS 中并(希望)从“仍待合并的内容”列表中消失。
2) 您是否拥有多个工作空间? (例如,我曾经尝试对主干使用普通的开发工作区,以及在主干和分支中映射的特殊合并工作区)
如果合并到一个工作区,则合并的文件将仅出现在该工作区的待处理更改中。请注意,“源代码管理”资源管理器和“待处理更改”窗口都有自己的“工作空间”下拉列表,如果您在 SC 资源管理器中切换工作空间(以进行合并),则您的待处理更改将不会被切换,因此将查找在不同的工作空间。这个问题让我困惑了好几次(“我已经完成了合并,但 TFS 没有更改任何文件。这是怎么回事?!”)
3)有时 TFS 似乎会感到困惑并且行为不稳定。随着 TFS 的每个新版本的出现,这种情况都会明显好转,但在 2010 年我仍然偶尔会遇到这种情况。(我知道这不是您想听到的答案:-)
I can think of a few possibilities:
1) (forgive me if it is stating the obvious) When you merge, the changes are made locally in your workspace, and are not committed to the TFS database. When the merge is completed you need to check in the changes before they will be reflected in TFS and (hopefully) disappear from the "things still to be merged" lists.
2) Have you got more than one workspace? (e.g I once tried using a normal Dev workspace for the trunk, and a special Merging workspace that mapped in both the trunk and the branch)
If you merge into one workspace, the merged files will only appear in your pending changes for that workspace. Note that the Source Control explorer and the Pending Chnages windows both have their own Workspace drop-down, and if you switch workspaces in your SC explorer (to do the merge), your pending changes will not be switched over, and so will be looking at a different workspace. This one caught me out a couple of times ("I've done a merge, but TFS hasn't changed any of the files. What's going on?!")
3) Sometimes TFS appears to get confused and behaves erratically. With each new version of TFS this gets significantly better, but it still happens to me occasionally in 2010. (This is not the answer you want to hear, I know :-)