使用TFS REST API获取Git Commit的最新关联工作项目 [英] Get latest Associated Work Items for Git Commit using TFS REST API

查看:347
本文介绍了使用TFS REST API获取Git Commit的最新关联工作项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图获取 GIT使用TFS REST API提交



我的请求URL如下所示:


$ b

http://tfs.server:8080 / tfs / X / Y /_apis/git/repositories/GettingStarted.UI/commits/80186d385522150ee43ca85891fef565f37518df?api-version=3



在回复中,我发现附加了相关的工作项目在评论中:

comment:合并PR 4357:客户端头中FEIN的校正格式\ \\' \\\
相关工作项目:#539077



然而,当一个新的工作项目与Git Commit关联时,评论不会更新用它。有没有办法以结构化的方式获取当前相关的工作项目?



谢谢

解决方案

你得到的是正确的情况。 Git提交可以通过多种方式链接到工作项目。在Pending Changes窗口中,可以使用UI功能添加工作项目,或者以 #ID 的形式向提交注释添加提及,其中ID是工作项ID。



根据您的评论,工作项目539077 通过#ID或通过UI链接到待处理更改期间的提交。但是,新工作项目也可以通过工作项UI或Rest API与同一个Git Commit关联。 新的链接工作项目不会在提交评论中更新



除非您更新提交的评论,否则评论的结果将不会当您使用TFS REST API查询GIT提交时发生变化。



对于与Git Commit关联的新工作项目,您只能查询新工作项目脚趾获取提交ID,无法查询提交以获取新的工作项ID。


I'm trying to get the associated Work Items of a GIT Commit using the TFS REST API.

My request URL looks like this:

http://tfs.server:8080/tfs/X/Y/_apis/git/repositories/GettingStarted.UI/commits/80186d385522150ee43ca85891fef565f37518df?api-version=3.0

In the response I have found the related work items appended to the Comment:

"comment": "Merged PR 4357: Corrected format of FEIN in client header\n\nCorrected format of FEIN in client header\n\nRelated work items: #539077"

However, when a new Work Item is associated to the Git Commit the comment is not updated with it. Is there a way to get the current associated Work Items in a structured way?

Thanks

解决方案

What you got is the correct situation. Git commits can be linked to work items for several ways. From the Pending Changes window, work items can be added using the UI features or by adding a mention to the commit comment in the form of "#ID" where ID is the work item ID.

According to your comment, work item 539077 is linked to the commit during the pending change either with #ID or through UI. However, when a new work item is also associated to the same Git Commit either through work item UI or Rest API. The new linked work item will not update in the commit comment.

Unless you update the comment of the commit, the result of comment will not change when you query a GIT Commit using the TFS REST API.

For a new Work Item associated to the Git Commit, you could only be able to query the new work item toe get the commit ID, not able to query the commit to get new work item ID.

这篇关于使用TFS REST API获取Git Commit的最新关联工作项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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