TFS API - 获取合并变更 [英] TFS API - Get merged changesets
本文介绍了TFS API - 获取合并变更的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个程序,读取介绍最新版本,并从中获取所有的变更。那么有可能确定是否changset我有它实际上是一个合并,并在它是从。
I have a program that reads the lastest build and gets all the changesets from it. It is then possible to determine if the changset that I have it actually a merge, and where it was from.
下面是我有:
List<IChangesetSummary> changeSets = InformationNodeConverters.GetAssociatedChangesets(build);
IEnumerable<Changeset> changesetDetails = changeSets.Select(x => versionControlServer.GetChangeset(x.ChangesetId));
// Determine is the first changeset was a merge
changesetDetails.First().IsMerge // How to check is the changeset is part of a merge?
更新:
UPDATE:
继答案如此到目前为止,我已经更新
Following the answers so far I have updated
foreach (var cs in changesetDetails)
{
foreach (Change change in cs.Changes)
{
if ((change.ChangeType & ChangeType.Merge) == 0)
continue;
foreach(var m in change.MergeSources)
但 MergeSources
总是空的。
推荐答案
使用 VersionControlServer。 GetChangesForChangeset
方法来代替。最后一个参数表示应列入合并源信息
Use the VersionControlServer.GetChangesForChangeset
method instead. The last parameter indicates that merge source information should be included.
List<IChangesetSummary> changeSets = InformationNodeConverters.GetAssociatedChangesets(build);
IEnumerable<Change> changes = changeSets.SelectMany(x => versionControlServer.GetChangesForChangeset(x.ChangesetId, false, Int32.MaxValue, null, null, true));
foreach (Change change in changes)
{
if ((change.ChangeType & ChangeType.Merge) == 0) continue;
foreach (var m in change.MergeSources)
{
// ...
}
}
这篇关于TFS API - 获取合并变更的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文