我刚刚做了一个工具,它做同样的事情。您需要的电话是 TrackMerges。好消息是您可以在一个电话中检查多个分支。这是一个代码片段:
var tfsCollection = new TfsTeamProjectCollection(new Uri(server), new NetworkCredential(username, password, userDomain));
tfsCollection.EnsureAuthenticated();
VersionControlServer versionControlServer = tfsCollection.GetService<VersionControlServer>();
ExtendedMerge[] merges = versionControlServer.TrackMerges(
new[] {changesetIdYouAreChecking},
new ItemIdentifier("$/Proj/Dev"),
new [] {new ItemIdentifier("$/Proj/Test"), new ItemIdentifier("$/Proj/Release")},
null);
foreach (ExtendedMerge extendedMerge in merges)
{
Console.WriteLine("Branch --> " + extendedMerge.TargetItem.Item);
Console.WriteLine("Changeset --> " + extendedMerge.TargetChangeset.ChangesetId);
}
如果 merges 变量不包含您要查找的分支,那么它还没有被合并。