有没有一种方法可以通过Dev Ops Service REST API获取请求请求中更改的行数? [英] Is there a way to get the amount of lines changed in a Pull Request via the Dev Ops Service REST API?

查看:60
本文介绍了有没有一种方法可以通过Dev Ops Service REST API获取请求请求中更改的行数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在写论文并分析代码审查的行为.为此,我想知道被审查的拉取请求的大小.其余的信息,例如作者,审阅者,时间等.我已经通过调用其余的API获得了.但是,我似乎找不到一种方法来获取每个文件中更改的行数或总数(也足够).

I am currently doing my thesis and analyzing the behavior for code reviews. For this I want to know the size of the pull request that is reviewed. The rest of the information for example authors, reviewers, times etc. I got already by calling the rest API. However I cannot seem to find a way to get the amount of lines changed in each file, or a total number (which is also sufficient).

我浏览了文档,找到了一些更改文件数量的方法,请参见

I have browsed the documentation and found some ways to get amount of files changed, see https://docs.microsoft.com/en-us/rest/api/azure/devops/git/commits/get%20commits?view=azure-devops-rest-5.1. However, I didn't found a way to get the amount of changed lines per file or a total amount.

那么有什么方法可以使请求请求中或两次提交之间的行数发生变化?

So is there a way to get amount of lines changed in a Pull Request or between two commits?

推荐答案

对于您的问题,恐怕目前尚无官方发布的REST API可以做到这一点.在

For your issue , I am afraid that there is currently no official released REST API to do that. A similar question has been answered in this case ,please refer to it for details, you can refer to these steps to achieve your requirements:

1.

1.Get a list of commits to get a commit’s commit id.

2.通过提交ID(步骤1)获取提交以获取父项值和存储库ID(_links> Repository> href末尾的值)(使用_links> Changes> href的URL可以获取文件路径,如果你不知道)

2.Get a commit by commit id (steps 1) to get parents value and repository id (The value at the end of _links>Repository>href) (Using the URL of _links>Changes>href can get file path if you don’t know)

3.通过此POST请求获取文件diff
https://dev.azure.com/{organization}/{project}/_api/_versioncontrol/fileDiff?__ v = 5& diffParameters = [data1]& repositoryId = [存储库ID]

3.Get file diff by this POST request
https://dev.azure.com/{organization}/{project}/ _api/_versioncontrol/fileDiff?__v=5&diffParameters=[data 1]&repositoryId=[repository id]

您还可以在我们的 UserVoice网站上添加对此功能的请求,这是我们提供产品建议的主要论坛,我们的产品经理和产品团队将认真审查您的建议.

You could also add your request for this feature on our UserVoice site, which is our main forum for product suggestions,our PM and product team will kindly review your suggestion.

这篇关于有没有一种方法可以通过Dev Ops Service REST API获取请求请求中更改的行数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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