Woori Roh
Woori Roh

Reputation: 63

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

I want to get all commit data from all branches via Bitbucket REST api 1.0 like this :

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

All I get is all commit data from a default branch only, not all branches.

What I want is like this :

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

Of course, it doesn't work. :/

I've already read the official document but I cannot find a clue. https://docs.atlassian.com/bitbucket-server/rest/6.10.1/bitbucket-rest.html#idp205

I guess, getting all branch list, and then searching all commits at each branch can be possible. It seems annoying because I have 200 projects and almost 4,000 repositories.

I need your help. Thank you.

Upvotes: 1

Views: 6417

Answers (1)

Woori Roh
Woori Roh

Reputation: 63

I found out there is currently no single endpoint to return all the commits associated with all branches.

There was a suggestion few years ago but it was rejected by the developers. https://jira.atlassian.com/browse/BSERV-5363

The only way to get all commits across all branches is :

  1. Make an api call for all the /branches
  2. For each branch make an api call for its /commits?until=
  3. Remove duplicate commits, then insert the branch commits by timestamp.

Upvotes: 3

Related Questions