如何使用Git检索与TFS 2013中的构建相关联的变更集? [英] How to retrieve changesets associated with a build in TFS 2013 with Git?

查看:123
本文介绍了如何使用Git检索与TFS 2013中的构建相关联的变更集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  buildDetail.Information.GetNodesByType(AssociatedChangeset(AssociatedChangeset))一旦你有一个IBuildDetail获得相关的changsets, )

然而,在TFS 2013中,Git无法返回任何变更集。



这可能是我没有正确配置TFS,但这是一个开箱即用的安装,而不是升级,所以我猜测新的git支持API已经改变。 / p>

任何帮助(或指向有用文档的链接)都将不胜感激。

解决方案

经过大量的摆弄之后,我终于找到了解决办法。 Changeset已更名为TFS 2013的git支持的Commit。因此,当你得到这样的构建细节时,你需要获得这些数据:

  var buildDetailSpec = _buildServer.CreateBuildDetailSpec(buildDefinitionUris); 
buildDetailSpec.InformationTypes = new [] {AssociatedCommit};

然后您照常执行查询:

  var buildQueryResult = _buildServer.QueryBuilds(new [] {buildDetailSpec}); 
var buildDetail = buildQueryResult [0] .Builds;

然后,您检索 commit ,而不是变更集,如下所示:

  var commit = buildDetail.Information.GetNodesByType(AssociatedCommit); 
var author = commits.First()。Fields [Author];
var comments = commits.First()。Fields [Message];

请注意,什么是评论已重命名为消息,什么是CheckedInBy已被重命名为作者(或者也许是提交者,它们对我而言始终是相同的值)。

Once you have an IBuildDetail getting the associated changsets used to be accomplished with:

buildDetail.Information.GetNodesByType("AssociatedChangeset")

However, in TFS 2013 with Git that fails to return any changesets.

It's possible I haven't configured TFS correctly, but this is an out of the box installation, not an upgrade, so I'm guessing with the new git support the API has changed.

Any help (or links to useful documentation) would be greatly appreciated.

解决方案

After a lot of fiddling around I finally found the solution. Changeset's have been renamed to Commit's for TFS 2013's git support. Consequently you need to ask for that data when you get build details like this:

var buildDetailSpec = _buildServer.CreateBuildDetailSpec(buildDefinitionUris);
buildDetailSpec.InformationTypes = new[] { "AssociatedCommit" };

Then you perform the query as usual:

var buildQueryResult = _buildServer.QueryBuilds(new [] { buildDetailSpec });
var buildDetail = buildQueryResult[0].Builds;

Then you retrieve the commit, not the changeset, like this:

var commits = buildDetail.Information.GetNodesByType("AssociatedCommit");
var author = commits.First().Fields["Author"];
var comments = commits.First().Fields["Message"];

Note that what was "Comment" has been renamed to "Message" and what was "CheckedInBy" has been renamed to "Author" (or maybe "Committer", they are always the same value for me).

这篇关于如何使用Git检索与TFS 2013中的构建相关联的变更集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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