summaryrefslogtreecommitdiff
path: root/lib/gitlab/bitbucket_server_import
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-07-12 23:17:05 -0700
committerStan Hu <stanhu@gmail.com>2018-07-12 23:17:05 -0700
commitec4109d413f6161b43ad4cc1a6251af30d3bcf03 (patch)
treec2db2b3ae4335752d014d43516526fca48187cf0 /lib/gitlab/bitbucket_server_import
parent15220291ae1752b9e36ad0b2320180614ec37c59 (diff)
downloadgitlab-ce-ec4109d413f6161b43ad4cc1a6251af30d3bcf03.tar.gz
Make Connection#post consistent with Connection#get and add specs
Diffstat (limited to 'lib/gitlab/bitbucket_server_import')
-rw-r--r--lib/gitlab/bitbucket_server_import/importer.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/gitlab/bitbucket_server_import/importer.rb b/lib/gitlab/bitbucket_server_import/importer.rb
index e948a038e8e..580dc0bb852 100644
--- a/lib/gitlab/bitbucket_server_import/importer.rb
+++ b/lib/gitlab/bitbucket_server_import/importer.rb
@@ -90,12 +90,11 @@ module Gitlab
shas.each do |branch_name, sha|
next if sha_exists?(sha)
- response = client.create_branch(project_key, repository_slug, branch_name, sha)
-
- if response.success?
+ begin
+ client.create_branch(project_key, repository_slug, branch_name, sha)
branches_created << branch_name
- else
- Rails.logger.warn("BitbucketServerImporter: Unable to recreate branch for SHA #{sha}: #{response.code}")
+ rescue BitbucketServer::Connection::ConnectionError => e
+ Rails.logger.warn("BitbucketServerImporter: Unable to recreate branch for SHA #{sha}: #{e}")
end
end
end