目前我有 2 个分支 - 开发和发布。
是否有可能获得从开发到发布的所有未合并的变更集?
目前我们使用默认的合并向导。但是它有一个很大的限制——它不能按用户过滤。所以我正在考虑构建一个应用程序,它将所有未合并的变更集从开发拉到发布,并允许我按用户过滤这些变更集。
您可以编写一个小型控制台应用程序,如下所示:
using System;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.VersionControl.Client;
namespace UnmergedChangesets
{
class Program
{
static void Main(string[] args)
{
TfsTeamProjectCollection tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://myserver:8080/collection"));
VersionControlServer vcs = (VersionControlServer) tpc.GetService(typeof (VersionControlServer));
MergeCandidate[] mergeCandidates = vcs.GetMergeCandidates("$/Development", "$/Release", RecursionType.Full);
}
}
}
这样您就可以进入分支mergeCandidates
中缺少的所有变更集。
如果你想进一步过滤某个用户,你可以这样做: Release
foreach (var mergeCandidate in mergeCandidates)
{
if(mergeCandidate.Changeset.Owner == @"DOMAIN\ChuckNorris")
{
//This is an unmerged changeset commited by Chuck
}
}
Take a look at codeproject if you the standard windows doesn't fit your needs.
Somebody has done such a type of application so you can look how it works
TFS 2010 SDK: Smart Merge - Programmatically Create your own Merge Tool
Edit
I forgot, i work with this project template for VS2010