如何获取特定团队项目的签入/变更集的历史记录? [英] How to get history of checkins/changsets for specific Team Project?

查看:28
本文介绍了如何获取特定团队项目的签入/变更集的历史记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 TFS 客户端 API 来尝试查询 TFS 2010 实例.我需要能够执行以下操作

I'm using the TFS Client API to try and query a TFS 2010 instance. I need to be able to do the following

  • 对于指定的团队项目,请说项目 A"
  • 获取最近签到此项目的历史列表(比如最近 50 次,或最后一天的列表)

然后能够遍历此列表并获取项目的一些元数据(理想情况下是文件和文件夹名称)

Then be able to iterate through this list and get some metadata for the items (file and folder names ideally)

我想我需要在 VersionControlServer 类上使用 QueryXXX 方法,但找不到关于如何使用它的任何有用或清晰的示例.

I think I need to use the QueryXXX methods on the VersionControlServer class, but cannot find any helpful or clear examples on how to use this.

我看到有 GetLastestChangesetId 方法,但这看起来不能限定于特定项目或目录.

I have seen there is GetLastestChangesetId method, but this doesn't look like it can be scoped to a specific project or directory.

推荐答案

这很简单:

var tfsUrl = "http://myTfsServer:8080/tfs/defaultcollection";
var sourceControlRootPath = "$/MyTeamProject";
var tfsConnection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(tfsUrl));
var vcs = tfsConnection.GetService<VersionControlServer>();

var changeSets = vcs.QueryHistory(sourceControlRootPath, RecursionType.Full);

foreach (var c in changeSets)
{
    var changeSet = vcs.GetChangeset(c.ChangesetId);
    foreach (var change in changeSet.Changes) 
    {
       // All sorts of juicy data in here
    }

}

这篇关于如何获取特定团队项目的签入/变更集的历史记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆