Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,555,780
Community Members
 
Community Events
184
Community Groups

Bitbucket Cloud - Check if a pull request has conflicts

Hello, using the Bitbucket CLOUD API:

  • Is there a way to check if a pull request has any conflicting files - and if so, obtain a list thereof?

Thanks in advance for any pointers!

2 answers

1 accepted

1 vote
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 17, 2023 • edited May 22, 2023

Hi Paolo and welcome to the community!

You can use the following API endpoint with the branches of the PR and without the topic query parameter

Example:

https://api.bitbucket.org/2.0/repositories/workspace-id/repo-slug/diffstat/feature..main

For the conflicted files, you will see in the output the field "status": "merge conflict".


The topic query parameter was introduced last year when we made changes in the diff algorithm we use:

The status "merge conflict" was not added as a status when the topic query is used, because we will eventually remove this status. When we do, we will provide a public conflict API endpoint for customers who use this status for that purpose, to ensure continuity.

Any changes in the API are announced here:

Kind regards,
Theodora

Hello Theodora, and thank you for your prompt reply.

This!... Exactly what I was looking for!

But please let me ask you: is there a more comprehensive documentation detailing payloads and responses, including for example the 'status' field that you have mentioned and its possible values?

I have found the API documentation to be fairly basic, to be honest, sometimes with broken links or poorly formatted examples. I guess many things can be discovered through trial-and-error attempts, but it would be nice to have a richer/better documentation to peruse -- and avoid me asking you silly questions... ;)

Cheers, Paolo

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 22, 2023

Hi Paolo,

That is the official documentation for our APIs. I just realized I provided the link to the diff endpoint instead of the diffstat, I edited my previous post to correct the URL.

While viewing info for this endpoint, scroll down to the section Responses (right below Example) > select Paginated Diff Stat, and a new window will open with details on the fields that are returned from this endpoint:

Screenshot 2023-05-22 at 10.36.08.png


If you scroll down this window, select Diff Stat (right below the field values) and you will see more fields documented (including the field status).

Please keep in mind that the status "merge conflict" is not documented there, because, as I mentioned, we will eventually remove it (it is also not available when using the topic query parameter).

Kind regards,
Theodora

Thank you Theodora

Yes, I was looking for "merge conflict" as a possible value for the status field, but now I understand why it's not listed -- hopefully the new public conflict API endpoint will be available soon :)

Cheers,

Paolo

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 30, 2023

You are welcome Paolo, please feel free to reach out if you ever need anything else!

Kind regards,
Theodora

0 votes
Ulrich Kuhnhardt _IzymesCo_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 16, 2023

Hi @Paolo_Ascari ,

me again :)

There is a Bitbucket cloud API endpoint that merges  a PR [1]. I am not sure if you could swap the POST method with a GET and see if you get the mergeability status?

Would be interesting, I haven't tried this yet.

Best, Ulrich

 

[1] https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pullrequests/#api-repositories-workspace-repo-slug-pullrequests-pull-request-id-merge-post

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events