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

查看:177
本文介绍了如何通过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的版本控制的路径,我们希望从最新的最新的变更历史,留下的参数一大堆都是在你的情况pretty默认值。

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天全站免登陆