Delete temporary branches after an import
This commit is contained in:
parent
c793252e8b
commit
0d9f74d2f5
1 changed files with 12 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue