Forums

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

Unable to close source branch on merge using Rest API

prsingh
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!
November 21, 2019

I am using BitBucket server version 6.5.1.

I am doing a pull followed by a merge, however post the merge the source doesn't get deleted even though I set 'closed' to true in my pull request. 

Pull API (POST) -  /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests

Sample Body: 

{"title":"test title","description":null,"state":"OPEN","open":true,"closed":true,"fromRef":{"id":"test_id","repository":{"name":null,"slug":"sample","project":{"key":"SAMPLE"},"state":null}},"toRef":{"id":"master","repository":{"name":null,"slug":"sample","project":{"key":"SAMPLE"},"state":null}}}

Sample Response: 

{"id":123,"merge_status":null,"version":0}

I then use the Merge API - /REST/API/1.0/PROJECTS/{PROJECTKEY}/REPOS/{REPOSITORYSLUG}/PULL-REQUESTS/{PULLREQUESTID}/MERGE?VERSION’

The pull and merge functionality are working fine, however the source doesn't get deleted.

I am referring the rest APIs using link - https://docs.atlassian.com/bitbucket-server/rest/6.5.1/bitbucket-rest.html#personal-repositories

What am I missing?

Thanks

1 answer

0 votes
Gonchik Tsymzhitov
Community Champion
November 23, 2019

Hi! 

I hope you need first remove PR, then branch. 

prsingh
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!
November 25, 2019

Hi, 

Thanks for the response.

I do not intend to delete the branch separately but to provide a functionality similar to ‘Delete source branch after merging’ – the check box that is seen in the UI, when a merge is done. I found a bug - 'https://jira.atlassian.com/browse/BSERV-10976' which seems to cover the issue.

Regards

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events