使用REST API检索项目的gerrit中的dir结构

时间:2018-01-31 19:48:03

标签: git rest gerrit

有没有办法使用rest api检索gerrit中特定分支中的文件夹和文件。我们可以检索特定项目的整个目录结构。

根据gerrit文档https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html 这个查询“/ projects / {project-name} / branches / {branch-id} / files”应该检索特定分支中的所有文件和文件夹,但是它丢弃的网站是错误的。

2 个答案:

答案 0 :(得分:2)

查看documentation,我无法找到任何提及“/ projects / {project-name} / branches / {branch-id} / files”端点,我只发现:

  

'GET / projects / {project-name} / branches / {branch-id} / files / {file-id} / content'

     

从某个分支的HEAD修订版中获取文件的内容。

其解释如下。

我认为通过REST获取目录的内容是不可能的。

答案 1 :(得分:1)

如果您使用gitiles插件,也许可以在下面尝试

GET /plugins/gitiles/{project-name}/+/{branch-id}/?format=json