使用TFS REST API在一个分支中获取项目的提交 [英] Get commits of an item in one branch with TFS REST API
问题描述
I am trying to get the history for one particular item in one particular branch in my git repository, using the Team Service REST API (https://www.visualstudio.com/en-us/docs/integrate/api/git/commits).
我的存储库中有这个结构.
I have this structure in my repository.
Repository1
-- Branch1
-- Item1
-- Item2
-- Branch2
-- Item1
-- Item3
Repository1
-- Branch1
-- Item1
-- Item2
-- Branch2
-- Item1
-- Item3
我如何只获取Branch1中Item1的提交?
How can I get the commits for just Item1 in Branch1?
使用JSON:
{
"itemVersion": {
"versionType": "branch",
"version": "Branch1"
}
}
{
"itemVersion": {
"versionType": "branch",
"version": "Branch1"
}
}
但这给了我整个分支的提交.我如何才能在特定分支中仅获取该项目的提交?
But this gives me the commits for the whole branch. How can I get the commits for just that item in that particular branch?
推荐答案
There isn't any direct way to get this with Rest API for now, you can submit a feature request on VSTS User Voice.
实现此目的的另一种方法是获取指定分支中的所有提交,并获取指定项目的所有提交,然后列出在两种情况下都存在的提交.
The alternative way to achieve this would be get all the commits in specified branch and get all the commits for specified item, and then list the commits exist in both scenarios.
这篇关于使用TFS REST API在一个分支中获取项目的提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!