是否有人成功构建了正确的url来从此端点检索文件内容?
我所有的尝试都得到了状态404。
此链接中的文档令人费解
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-edit-file
下面是它提供的示例
GET /changes/{change-id}/edit/path%2fto%2ffile这是来自gerrit的数据。
{
"branch": "BR16516",
"change_id": "Ieb84eb99147fc39d3e117fe61eef8389d2f64611",
"change_number": "52490",
"change_revision": "2",
"file_name": "sql/BR16516-update-order-15102.sql",
"lines_inserted": 77,
"size_delta": 2041,
"status": "A"
}我似乎无法为gerrit识别的{change-id}和{'path%2fto%2ffile'}提供值
我提供的值(见上面所示)与从这里记录的/changes端点检索到的值相同- https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes
以下是提供的代码示例:
从更改编辑中检索文件的内容。
请求GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
在这个例子中,文件名是'foo‘,但是{change-id}引入了myProject~master~,我试着用它代替我的项目的相关值,但没有成功。
如果有其他端点可以为我提供来自分支中文件的纯文本,那也很好。
发布于 2019-02-25 23:52:16
我设法从这个端点获取了文件内容。
获取/changes/{change-id}/revisions/{revision-id}/files/{file-id}/content
change_id是变更记录中的id版本- id是变更记录中的修订id
更改记录来自查询更改终结点
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes
https://stackoverflow.com/questions/54862288
复制相似问题