tfs - 如何查找未链接到工作项的TFS变更集

标签 tfs tfs-sdk

是否可以通过查询或以编程方式识别未链接到工作项的所有TFS变更集?

最佳答案

当然,您可以使用TFS API轻松完成此操作。

public static void GetAllChangesetsWithNoWorkItems()
{
    var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://tfs2010/tfs/default"));
    var service = tfs.GetService<VersionControlServer>();

    var histories = service.GetBranchHistory(new ItemSpec[] { new ItemSpec(@"$/ProjectName/MAIN/BUILD", RecursionType.OneLevel) }, VersionSpec.Latest);

    foreach (BranchHistoryTreeItem history in histories[0])
    {
        var change = service.GetChangeset(history.Relative.BranchToItem.ChangesetId, true, true);

        if(change.WorkItems.ToList().Count == 0)
        {
            Debug.Write(String.Format("Work Item Missing for Changeset {0}", change.ChangesetId));
        }
    }
}

您可以阅读有关如何以编程方式连接到TFS API的博客文章http://geekswithblogs.net/TarunArora/archive/2011/06/18/tfs-2010-sdk-connecting-to-tfs-2010-programmaticallyndashpart-1.aspx

关于tfs - 如何查找未链接到工作项的TFS变更集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6734420/

相关文章:

tfs - 我可以在 TFS 2010 中隐藏选定区域/迭代节点吗?

visual-studio-2013 - 尝试添加文件到TFS时添加“The item already exists”

unit-testing - 从 TFS-SDK 查询失败的单元测试?

tfs - 使用 TFS API 按 Id 获取特定 TestSuite

c# - 一个单独的线程是否需要它自己的 VersionControlServer 实例才能与另一个线程同时工作?

TFS 2013 : How to get changeset comments into a text file?

c# - Microsoft.Web.Infrastructure 未构建到我的 TFS 构建服务器之一的 bin 目录中

json - TFS API - WIQL - 查询只返回 id 和 url

tfs - Team Foundation Server 2018 API 构建定义错误

unit-testing - VS 2015 : TF900547: The directory containing the assemblies for the Visual Studio Test Runner is not valid ''