如何通过 bitbucket REST api 1.0 从所有分支获取所有提交?

How to get all commits from all branches via bitbucket REST api 1.0?

我想通过 Bitbucket REST api 1.0 从所有分支获取所有提交数据,如下所示:

curl -u $id:$password http://$path/rest/api/1.0/projects/$project/repos/$slug/commits

我得到的只是来自默认分支的所有提交数据,而不是所有分支。

我想要的是这样的:

curl -u $id:$password http://$path/rest/api/1.0/projects/$project/repos/$slug/commits?branches=all

当然不行。 :/

我已经看过官方文档,但我找不到线索。 https://docs.atlassian.com/bitbucket-server/rest/6.10.1/bitbucket-rest.html#idp205

我猜,获取所有分支列表,然后搜索每个分支的所有提交是可能的。这似乎很烦人,因为我有 200 个项目和将近 4,000 个存储库。

我需要你的帮助。 谢谢。

我发现目前没有单一端点到return与所有分支关联的所有提交。

几年前有人提出过建议,但被开发者否决了。 https://jira.atlassian.com/browse/BSERV-5363

获得所有分支的所有提交的唯一方法是:

  1. 为所有 /branches
  2. 调用 api
  3. 对于每个分支,对其 /commits?until=
  4. 进行 api 调用
  5. 删除重复提交,然后按时间戳插入分支提交。