如何通过 TFS API 获取最新的变更集编号 [英] How can I get the latest change-set number via TFS API

查看:26
本文介绍了如何通过 TFS API 获取最新的变更集编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过 TFS API 获取最新的变更集编号?可以举个例子吗?

How can I get the latest change-set number via TFS API? Could you give me an example?

推荐答案

给你:

TeamProjectPicker tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, true);
tpp.ShowDialog();

var tpc = tpp.SelectedTeamProjectCollection;

VersionControlServer versionControl = tpc.GetService<VersionControlServer>();

var tp = versionControl.GetTeamProject("MyTeamProject");
var path = tp.ServerItem;

var q = versionControl.QueryHistory(path, VersionSpec.Latest, 0, RecursionType.Full, null, VersionSpec.Latest, VersionSpec.Latest, Int32.MaxValue, true, true, false, false);

Changeset latest = q.Cast<Changeset>().First();

// The number of the changeset
int id = latest.ChangesetId;

QueryHistory 是使用 TeamProject 的 VersionControl 中的路径调用的,我们想要从最新到最新变更集的历史记录,剩下的一大堆参数在您的情况下都是默认的.

QueryHistory is invoked with the path in the VersionControl of your TeamProject, we want the history from the latest to the latest changeset, the whole bunch of parameters left are pretty default in your case.

这篇关于如何通过 TFS API 获取最新的变更集编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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