Bitbucket Server: How to obtain real commit hashes from an effective diff hash? Edited

When querying the API for commit comments, I sometimes get anchors that have a diffType of "EFFECTIVE" with a toHash that appears to be generated somehow.  Is there a way that I can use this data to get a list of commits used for this "effective" diff?

Here's an example from the "activities" endpoint:



1 answer

0 vote

Hi @Synthead

Thanks for reaching out. I'm not 100% of what information you are after. If you are looking for a list commits in the pull request, then the pull request commits endpoint (or the PullRequestService.getCommits endpoint in Java) could give you what you are after.

The EFFECTIVE diff type is the diff that pull requests display by default. To produce this diff, the fromHash is the HEAD of the PullRequest.getToRef. The toHash is calculated by merging the PullRequest.getFromRef and PullRequest.getToRef. In essence the effective diff shows users "how the target branch will change if the PR was merged as is". You can find more information about the diff in this post.

Hope this is the information you were looking for.


Juan Palacios

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

29,781 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you