Delete temporary branches after an import

This commit is contained in:
Stan Hu 2018-07-13 15:43:15 -07:00
parent c793252e8b
commit 0d9f74d2f5

View file

@ -29,6 +29,7 @@ module Gitlab
def execute
import_repository
import_pull_requests
delete_temp_branches
handle_errors
true
@ -142,6 +143,17 @@ module Gitlab
end
end
def delete_temp_branches
@temp_branches.each do |branch_name|
begin
client.delete_branch(project_key, repository_slug, branch_name)
project.repository.delete_branch(branch_name)
rescue BitbucketServer::Connection::ConnectionError => e
@errors << { type: :delete_temp_branches, branch_name: branch_name, errors: e.message }
end
end
end
def import_bitbucket_pull_request(pull_request)
description = ''
description += @formatter.author_line(pull_request.author) unless find_user_id(pull_request.author_email)