Reputation: 1591
I am building an app to which requires all the commit comments from git commits against a branch on remote origin. Our repository is hosted on a BitBucket server and is a Git repository.
I have looked over the Bitbucket (Stash) REST api and I can bring back the git comments by browsing the commits, something like this:
https://mybitbucket.local/rest/api/1.0/projects/myslug/repos/myproduct/commits?limit=1000&branch=mybranch
What I need now, just to make it more efficient, is a mechanism to request the content from just between two tags. Is this possible? I imagine providing two tags as parameters, like &fromTag=X&toTag=y...
I cannot find this, and the documentation is a little sparse... :(
Is there a way?
Upvotes: 4
Views: 4992
Reputation: 5517
See Bitbucket Server's "compare/commits" REST API call:
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/compare/commits
"Gets the commits accessible from the {@code from} commit but not in the {@code to} commit."
Here's an example call against my demo server (probably need to login as user "test" with pass "test" first) that returns with 5 commits that can be seen from a6e64f4fd0e
but are not visible from master
:
Since you're using Bitbucket/Stash, you might be interested in my Bit-Booster Commit Graph and More add-on to visually verify the correct commits are being returned, like so:
In this case the 5 commits that match "AUI-1546" are the ones my example "commits/compare" REST API call above is returning. You can see quite clearly on this graph how they are precisely the 5 commits that are 1.) accessible from a6e64f4fd0e
and 2.) not accessible from master
.
Upvotes: 3