From c793252e8b33a1b7d071aca90c9c05e54ad973b5 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 13 Jul 2018 15:39:24 -0700 Subject: Add support for deleting branches via the Bitbucket Server API --- lib/bitbucket_server/client.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/bitbucket_server/client.rb') diff --git a/lib/bitbucket_server/client.rb b/lib/bitbucket_server/client.rb index 802fe7953ce..bfa8301f643 100644 --- a/lib/bitbucket_server/client.rb +++ b/lib/bitbucket_server/client.rb @@ -36,6 +36,15 @@ module BitbucketServer connection.post("/projects/#{project_key}/repos/#{repo}/branches", payload.to_json) end + def delete_branch(project_key, repo, branch_name, sha) + payload = { + name: Gitlab::Git::BRANCH_REF_PREFIX + branch_name, + dryRun: false + } + + connection.delete(:branches, "/projects/#{project_key}/repos/#{repo}/branches", payload.to_json) + end + private def get_collection(path, type) -- cgit v1.2.1