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

retrieve dir structure in gerrit for a project using REST API

有什么方法可以使用 rest 在 gerrit 的特定分支中检索文件夹和文件 api.Can 我们检索特定项目的整个目录结构。

根据 gerrit 文档 https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html 此查询“/projects/{project-name}/branches/{branch-id}/files”应该检索特定分支中的所有文件和文件夹,但它抛出无法访问站点错误。

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

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

Gets the content of a file from the HEAD revision of a certain branch.

如解释的那样工作。

我认为无法通过 REST 获取目录的内容。

如果你使用了 gitiles 插件,也许你可以尝试下面的方法

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