使用TFS REST API在一个分支中获取项目的提交 [英] Get commits of an item in one branch with TFS REST API

查看:113
本文介绍了使用TFS REST API在一个分支中获取项目的提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Team Service 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?

我尝试过发布: https://fabrikam.visualstudio.com/DefaultCollection/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/commitsBatch?api-version=1.0

使用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?

推荐答案

目前尚无直接方法可通过Rest API来获得,您可以在

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屋!

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