问题
Currently I have 2 branches - Development and Release.
Is it possible to obtain all unmerged changesets from Development to Release?
Currently we use the default Merge Wizzard. However it has one big limitation - it cannot filter by user. So I was thinking of building an app that will pull all unmerged changesets from Development to Release and allow me to filter those changesets by user.
回答1:
You could write a small console app that goes like this:
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);
}
}
}
This way you get into mergeCandidates
all changesets that are missing in your Release
branch.
If you want to further filter for a certain user you can do this with something like that:
foreach (var mergeCandidate in mergeCandidates)
{
if(mergeCandidate.Changeset.Owner == @"DOMAIN\ChuckNorris")
{
//This is an unmerged changeset commited by Chuck
}
}
回答2:
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
Visual Studio 2010 Project Template for TFS Utilities
来源:https://stackoverflow.com/questions/8201227/how-to-get-all-unmerged-changesets-for-a-branch-using-tfs-2010-sdk