I need to detect when a pull request couldn't be merged because of merge conflicts (as soon as possible). Do I have to poll the log files or is there any better way?
Best way would be a plugin that is triggered on a conflicting pull request.
Depending on your use case, you could poll the list of open Pull Requests via the REST API:
and then use the merge status end-point at:
to determine which are conflicted.
I'd stagger how quickly you call merge end-point though. Calculating merge results can be a very expensive operation, depending on the size of the PR, so calling it to rapidly may hurt performance.
[Also copying the content in case the link becomes unavailable]
So was in the same pinch, checked source code of the pull request html page and found out that there is indeed an endpoint for checking conflicts.
And that is *Drumroll please*
For example I got the pull request id from:
Then used that ID in the above conflict-check endpoint.
thanks for trying to help in this case. I cannot open the link you posted even now, but it looks like the conent is for Bitbucket Cloud? The question was for Bitbucket Server and this resource doesn't exist for Bitbucket Server.
We now use a Git merge driver to detect conflicts in pull requests.
Oh, sorry man. There was one trailing space after the URL. Anyway, Yeah thought the api endpoints will be there with a little variation.
Can you check the
is there or not, using your format of the request url? The funny thing is in the bitbucket cloud also the v1 REST api /pullrequests endpoint is not there.. but /pullrequests/ID/conflict-status is there.
Anyway, sorry if I couldn't help you out. It seemed that it was a feasible and more than likely probable solution
I tested it:
"message": "null for uri: ***/pull-requests/27/conflict-status",
Bitbucket Cloud and Bitbucket Server don't share any code base, they are fully independent applications.
For this case the merge driver is the best solution, using the REST API was a totally wrong approach.
As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...
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!
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