summaryrefslogtreecommitdiff
path: root/lib/gitlab/bitbucket_server_import
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-07-13 15:43:15 -0700
committerStan Hu <stanhu@gmail.com>2018-07-13 15:43:15 -0700
commit0d9f74d2f5510b6ba449ac20956f96dc555a46c2 (patch)
tree259381633e86fad4bd85d5a0fd5660a0a2b88105 /lib/gitlab/bitbucket_server_import
parentc793252e8b33a1b7d071aca90c9c05e54ad973b5 (diff)
downloadgitlab-ce-0d9f74d2f5510b6ba449ac20956f96dc555a46c2.tar.gz
Delete temporary branches after an import
Diffstat (limited to 'lib/gitlab/bitbucket_server_import')
-rw-r--r--lib/gitlab/bitbucket_server_import/importer.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/gitlab/bitbucket_server_import/importer.rb b/lib/gitlab/bitbucket_server_import/importer.rb
index 580dc0bb852..cc21e7aad9e 100644
--- a/lib/gitlab/bitbucket_server_import/importer.rb
+++ b/lib/gitlab/bitbucket_server_import/importer.rb
@@ -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)