简体   繁体   English

如何在TFS中查询历史记录?

[英]How to query history in TFS?

I know every TFS work item shows it's history, but it's "find the difference" painful process... How can I query by history to see WHAT was actually changed? 我知道每个TFS工作项都显示了它的历史记录,但是这是“发现差异”的痛苦过程……如何通过历史记录查询实际发生了什么变化? Assume I don't know what was changed, or that multiple items were changed, so I can't use an actual word or phrase 假设我不知道更改了什么,或者多项更改了,所以我不能使用实际的单词或短语

Are you using Visual Studio Online (VSO)? 您正在使用Visual Studio Online(VSO)吗? If so, you can use the REST API and specifically the Updates method to see what changed in each revision of a work item. 如果是这样,则可以使用REST API,尤其是使用Updates方法来查看工作项的每个修订中的更改。 This will let you easily see the difference between two consecutive revisions. 这将使您轻松地看到两个连续修订版之间的差异。

If you want the changes between, say, revision 3 and revision 8 then you will need to aggregate the individual revision changes yourself to see the net difference between those two revisions. 如果要在修订版3和修订版8之间进行更改,则需要自己汇总各个修订版更改,以查看这两个修订版之间的净差异。

If you're using an on-premise TFS server then you'll be using the .NET API. 如果使用本地TFS服务器,则将使用.NET API。 For that, have a look at this CodeProject article for more information, but the basics are that you need to do something like this to see all the revision information: 为此,请查看此CodeProject文章以了解更多信息,但基本操作是您需要执行以下操作才能查看所有修订信息:

var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(
                    new Uri("https://tfs2010:8080/defaultcollection"));
var service = tfs.GetService<WorkItemStore>();
var workItem = service.GetWorkItem(id);
foreach (Revision revision in workItem.Revisions)
{
  foreach (Field field in wi.Fields)
  {
    //Do something interesting here instead
    var change = revision.Fields[field.Name].Value
  }
}

From there, it's up to you to work out what information you're actually interested in. 从那里开始,由您决定您真正感兴趣的信息。

have a look at the: work item history visualizer 看看: 工作项历史记录可视化器

also, there's get-tfsitemhistory 另外,还有get-tfsitemhistory

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM