You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The ultimate task I need to perform is to extract the the commits that are made to a specific branch between two time points. This is quite easy to achieve with git CLI but I am limited to Bitbucket API v1.
Of course it's not a problem to get all commits:
But then I have no branch context.
The only query that I can made successfully is to retrieve the latest commit of the branch:
Basically what I am missing is the ability to make a connection between a branch and a commit.
Any help will be appreciated.
Hello Taras and welcome to the Community!
I research a bit on your question about linking commits to a specific Bitbucket branch and found there is a possible solution within the v1 API for Bitbucket Server. While the documentation is not exactly clear on how to accomplish this, I did find a community post where someone figured out how to do this along with a StackOverflow thread on a similar topic.
The StackOverflow thread reports the following may work for your needs:
Along with this, the Community post reports the following also worked for their requirements (This is similar to your API call on getting the last commit):
From my understanding on this, you should be able to use the StackOverflow response to call against the feature branch within Bitbucket and have it return commits for the said branch. Please give this a try and let us know the results.
We look forward to hearing back from you so we may find a way to link Commits to Branches within Bitbucket Server.
Unfortunately both solutions (which are in fact identical) produce the same outcome - the latest commit of the desired branch. Meaning that it leavens me with nothing to retrieve the other commits from the same branch.
I kind of found a partial solution by reverse engineering. Thus master branch commits always have their previous commit as a parent. Thus it is only a matter of traversing "parent->parent->parent..." until the required depth is reached. All these "parent" items are the commits of the master branch.
But this only works because in my case we have a strict policy of not committing to master directly and only merging feature branches instead.
Meaning that this problem cannot be solved reliably. Unfortunately.
Thank you Stephen anyway.