2011-07-18 28 views

回答

1

当然,您可以使用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

6

使用TFS的PowerToy的PowerShell的模块:

从工作区中的任何文件夹你感兴趣:

Get-TfsItemHistory . -Recurse | Where-Object { $_.WorkItems.Length -eq 0 } 

这将让当前文件夹和所有子文件夹的历史,然后筛选为空的工作项目清单。

+0

看到答案[这里](http://stackoverflow.com/questions/1050689/how如果(像我一样),你不知道如何让PowerShell插件工作。 – DeanOC

0

我不知道Richard's Answer,但接受的答案了近2分钟,从我的团队项目的根目录下运行采集。如果你正在寻找一个特定的用户,它会在10秒内运行,如果你不在,则会运行47秒。

service.QueryHistory("$/TeamProject/", VersionSpec.Latest,0, RecursionType.Full,userName,null,null, Int32.MaxValue,true,false) 
    .Cast<Changeset>() 
    .Where(cs=>cs.AssociatedWorkItems.Length==0) 

,如果你是不是在找一个特定的用户只需设置userName为null

http://share.linqpad.net/6sumno.linq

相关问题