summaryrefslogtreecommitdiff
path: root/app/controllers/import/bitbucket_controller.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-11-11 15:44:52 -0800
committerStan Hu <stanhu@gmail.com>2016-11-21 16:47:27 -0800
commite2688feeb3075265fb926bbd68560b2046afa0c5 (patch)
tree35bf3307d7083750d5b3374e15a19af5cda41128 /app/controllers/import/bitbucket_controller.rb
parent478730bebd5c8a9505490d2b396ac3c866da1b09 (diff)
downloadgitlab-ce-e2688feeb3075265fb926bbd68560b2046afa0c5.tar.gz
Address initial review comments
Diffstat (limited to 'app/controllers/import/bitbucket_controller.rb')
-rw-r--r--app/controllers/import/bitbucket_controller.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/app/controllers/import/bitbucket_controller.rb b/app/controllers/import/bitbucket_controller.rb
index e7150cb8e95..72c90f9daf2 100644
--- a/app/controllers/import/bitbucket_controller.rb
+++ b/app/controllers/import/bitbucket_controller.rb
@@ -17,11 +17,10 @@ class Import::BitbucketController < Import::BaseController
end
def status
- client = Bitbucket::Client.new(credentials)
- repos = client.repos
+ bitbucket_client = Bitbucket::Client.new(credentials)
+ repos = bitbucket_client.repos
- @repos = repos.select(&:valid?)
- @incompatible_repos = repos.reject(&:valid?)
+ @repos, @incompatible_repos = repos.partition { |repo| repo.valid? }
@already_added_projects = current_user.created_projects.where(import_type: 'bitbucket')
already_added_projects_names = @already_added_projects.pluck(:import_source)
@@ -36,15 +35,15 @@ class Import::BitbucketController < Import::BaseController
end
def create
- client = Bitbucket::Client.new(credentials)
+ bitbucket_client = Bitbucket::Client.new(credentials)
@repo_id = params[:repo_id].to_s
name = @repo_id.gsub('___', '/')
- repo = client.repo(name)
+ repo = bitbucket_client.repo(name)
@project_name = params[:new_name].presence || repo.name
repo_owner = repo.owner
- repo_owner = current_user.username if repo_owner == client.user.username
+ repo_owner = current_user.username if repo_owner == bitbucket_client.user.username
@target_namespace = params[:new_namespace].presence || repo_owner
namespace = find_or_create_namespace(@target_namespace, repo_owner)