TFS客户端C#API-获取项目的所有变更集 [英] TFS client C# API - get all changesets of an Item

查看:351
本文介绍了TFS客户端C#API-获取项目的所有变更集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VS 2010的Microsoft TFS客户端:

Microsoft TFS client for VS 2010:

http://msdn.microsoft.com/zh-cn/library/microsoft.teamfoundation.versioncontrol.client.item(v = vs .100).aspx


  • 我(即我的代码)有一个变更集。

  • 我要迭代特定的更改。

  • 我在更改中有一个项目。

现在,我希望获得所有具有该项目更改的更改集。

Now, I wish to get all Changesets that had Changes for that item.

有人可以建议我最好的方法吗?

Could someone advise me the best way to do that?

我可以遍历相关分支的所有变更集,这会非常低效。

I could iterate thro all the Changesets of the branch concerned, which would be very inefficient.

推荐答案

爱德华是正确的。而且他具有备份的凭据。 (请参阅他的个人资料描述)
VersionControlServer.QueryHistory是您需要使用的方法。有几种方法使用它,我仅在下面描述它,假设该项目的服务器路径对您来说很重要...

Edward is correct. And he has the credentials to back it up. (See his profile description) VersionControlServer.QueryHistory is the method you need to use. There are several ways to use it and I'm only describing one below which assumes that the server path of that item is what is important to you...

首先,您需要服务器路径项的内容:

First, you need the server path of the Item:

string serverPath = Item.ServerItem;

接下来,如果尚未实例化VersionControlServer对象,则可以从TeamProject中获得一个像这样:

Next, if you don't already have a VersionControlServer object instantiated, you can get one from your TeamProject like this:

VersionControlServer VCServer = (VersionControlServer)this.TeamProject.Store.TeamProjectCollection.GetService(typeof(VersionControlServer));

使用VersionControlServer QueryHistory(string,boolean)方法获取与该服务器路径关联的其他变更集: / p>

Use the VersionControlServer QueryHistory(string, boolean) method to get other changesets associated with that server path:

VCServer.QueryHistory(serverPath, false);

这篇关于TFS客户端C#API-获取项目的所有变更集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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