The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any way to determine pull request # by a commit hash

Sergey K
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 4, 2015

For better tracing closed tasks in continuous integration process it is very convenient to have information about a merged pull request (number/description) instead of a particular commit (hash/comment). Unfortunately, the only information that can be provided by GIt is information about a commit (especially if this was a fast-forward commit). Is there any way to determine a number of a pull request by a commit hash from a script/command line (using Stash REST API or plugins)?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
June 4, 2015

On the Java API, it is easy to get from the pull request to the commit hash by using PullRequest.getFromRef(). Something like this probably exists on the REST API too.

Getting to the pull request from the commit hash is more tricky. You can use PullRequestService.search() to find a Pull Request based on the branch (ref) if you use a PullRequestSearchRequest with getFromRefIds(). Not sure how to get the ref based on the commit hash, though.

David Karr
Contributor
July 12, 2018

Perhaps a response on this will make it bubble up, but I'm trying to figure out a way to do this also.

TAGS
AUG Leaders

Atlassian Community Events