Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-08-07 17:46:05 +0300
committerDouwe Maan <douwe@gitlab.com>2015-08-07 17:46:05 +0300
commit0c3170193277320aa2be287b2f5cb7ccac7b4cdf (patch)
tree7207e2af990c890bf3cbf8e853f334c9080fc373
parent4773f38e28c91dbbb6e5e385e0c403877298bfed (diff)
parentd7accda1ae42fe2036060aaf3ef4447e8f352e35 (diff)
Merge branch 'bitbucket-show-incompatible' into 'master'
Show incompatible projects in Bitbucket import status ### What does this MR do? This MR displays incompatible Bitbucket projects (e.g. SVN, hg) in the status table. ### Why was this MR needed? Users are confused when they don't see projects show up. The import list should show incompatible projects as we do for Google Code to make it more obvious to the user what is happening. (See !586 and 9c76a6fa). ### Screenshot ![image](https://gitlab.com/gitlab-org/gitlab-ce/uploads/264b080114c809c4a3a79580594af8b2/image.png) ### What are the relevant issue numbers? #1871 See merge request !1114
-rw-r--r--CHANGELOG1
-rw-r--r--app/controllers/import/bitbucket_controller.rb1
-rw-r--r--app/views/import/bitbucket/status.html.haml33
-rw-r--r--lib/gitlab/bitbucket_import/client.rb4
-rw-r--r--spec/controllers/import/bitbucket_controller_spec.rb4
5 files changed, 37 insertions, 6 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 973425295c1..b7a173e8267 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
Please view this file on the master branch, on stable branches it's out of date.
v 7.14.0 (unreleased)
+ - Show incompatible projects in Bitbucket import status (Stan Hu)
- Fix coloring of diffs on MR Discussion-tab (Gert Goet)
- Fix "Network" and "Graphs" pages for branches with encoded slashes (Stan Hu)
- Fix errors deleting and creating branches with encoded slashes (Stan Hu)
diff --git a/app/controllers/import/bitbucket_controller.rb b/app/controllers/import/bitbucket_controller.rb
index af0b841f0b7..4e6c0b66634 100644
--- a/app/controllers/import/bitbucket_controller.rb
+++ b/app/controllers/import/bitbucket_controller.rb
@@ -22,6 +22,7 @@ class Import::BitbucketController < Import::BaseController
def status
@repos = client.projects
+ @incompatible_repos = client.incompatible_projects
@already_added_projects = current_user.created_projects.where(import_type: "bitbucket")
already_added_projects_names = @already_added_projects.pluck(:import_source)
diff --git a/app/views/import/bitbucket/status.html.haml b/app/views/import/bitbucket/status.html.haml
index 9d2858e4e72..98ae509096e 100644
--- a/app/views/import/bitbucket/status.html.haml
+++ b/app/views/import/bitbucket/status.html.haml
@@ -3,11 +3,16 @@
%i.fa.fa-bitbucket
Import projects from Bitbucket
-%p.light
- Select projects you want to import.
-%hr
-%p
- = button_tag 'Import all projects', class: "btn btn-success js-import-all"
+- if @repos.any?
+ %p.light
+ Select projects you want to import.
+ %hr
+ %p
+ - if @incompatible_repos.any?
+ = button_tag 'Import all compatible projects', class: "btn btn-success js-import-all"
+ - else
+ = button_tag 'Import all projects', class: "btn btn-success js-import-all"
+
%table.table.import-jobs
%thead
@@ -41,6 +46,24 @@
= "#{repo["owner"]}/#{repo["slug"]}"
%td.import-actions.job-status
= button_tag "Import", class: "btn js-add-to-import"
+ - @incompatible_repos.each do |repo|
+ %tr{id: "repo_#{repo["owner"]}___#{repo["slug"]}"}
+ %td
+ = link_to "#{repo["owner"]}/#{repo["slug"]}", "https://bitbucket.org/#{repo["owner"]}/#{repo["slug"]}", target: "_blank"
+ %td.import-target
+ %td.import-actions-job-status
+ = label_tag "Incompatible Project", nil, class: "label label-danger"
+
+- if @incompatible_repos.any?
+ %p
+ One or more of your Bitbucket projects cannot be imported into GitLab
+ directly because they use Subversion or Mercurial for version control,
+ rather than Git. Please convert
+ = link_to "them to Git,", "https://www.atlassian.com/git/tutorials/migrating-overview"
+ and go through the
+ = link_to "import flow", status_import_bitbucket_path
+ again.
+
:coffeescript
new ImporterStatus("#{jobs_import_bitbucket_path}", "#{import_bitbucket_path}")
diff --git a/lib/gitlab/bitbucket_import/client.rb b/lib/gitlab/bitbucket_import/client.rb
index 778b76f6890..aec44b8c87b 100644
--- a/lib/gitlab/bitbucket_import/client.rb
+++ b/lib/gitlab/bitbucket_import/client.rb
@@ -87,6 +87,10 @@ module Gitlab
JSON.parse(get("/api/1.0/user/repositories").body).select { |repo| repo["scm"] == "git" }
end
+ def incompatible_projects
+ JSON.parse(get("/api/1.0/user/repositories").body).reject { |repo| repo["scm"] == "git" }
+ end
+
private
def get(url)
diff --git a/spec/controllers/import/bitbucket_controller_spec.rb b/spec/controllers/import/bitbucket_controller_spec.rb
index d5d9310e603..89e595121a7 100644
--- a/spec/controllers/import/bitbucket_controller_spec.rb
+++ b/spec/controllers/import/bitbucket_controller_spec.rb
@@ -39,12 +39,14 @@ describe Import::BitbucketController do
it "assigns variables" do
@project = create(:project, import_type: 'bitbucket', creator_id: user.id)
- stub_client(projects: [@repo])
+ client = stub_client(projects: [@repo])
+ allow(client).to receive(:incompatible_projects).and_return([])
get :status
expect(assigns(:already_added_projects)).to eq([@project])
expect(assigns(:repos)).to eq([@repo])
+ expect(assigns(:incompatible_repos)).to eq([])
end
it "does not show already added project" do