From f85712fb9814170aac631c7c24ca287fe5a0eb04 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 12 Jul 2018 15:26:37 -0700 Subject: [PATCH] Use browse URL of project to link imports --- app/views/import/bitbucket_server/status.html.haml | 6 +++--- lib/bitbucket_server/representation/repo.rb | 2 +- lib/gitlab/bitbucket_server_import/project_creator.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/import/bitbucket_server/status.html.haml b/app/views/import/bitbucket_server/status.html.haml index 81eac62c1ef..5f5597e557c 100644 --- a/app/views/import/bitbucket_server/status.html.haml +++ b/app/views/import/bitbucket_server/status.html.haml @@ -35,7 +35,7 @@ - @already_added_projects.each do |project| %tr{ id: "project_#{project.id}", class: "#{project_status_css_class(project.import_status)}" } %td - = link_to project.import_source, "https://bitbucket.org/#{project.import_source}", target: '_blank', rel: 'noopener noreferrer' + = link_to project.import_source, project.import_source, target: '_blank', rel: 'noopener noreferrer' %td = link_to project.full_path, [project.namespace.becomes(Namespace), project] %td.job-status @@ -73,14 +73,14 @@ - @incompatible_repos.each do |repo| %tr{ id: "repo_#{repo.owner}___#{repo.slug}" } %td - = link_to repo.full_name, "https://bitbucket.org/#{repo.full_name}", target: '_blank', rel: 'noopener noreferrer' + = link_to repo.full_name, repo.browse_url, target: '_blank', rel: 'noopener noreferrer' %td.import-target %td.import-actions-job-status = label_tag 'Incompatible Project', nil, class: 'label badge-danger' - if @incompatible_repos.any? %p - One or more of your Bitbucket projects cannot be imported into GitLab + One or more of your Bitbucket Server 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' diff --git a/lib/bitbucket_server/representation/repo.rb b/lib/bitbucket_server/representation/repo.rb index 6e15f7e2fce..8e163e8a1fc 100644 --- a/lib/bitbucket_server/representation/repo.rb +++ b/lib/bitbucket_server/representation/repo.rb @@ -18,7 +18,7 @@ module BitbucketServer end def browse_url - raw.dig('project', 'links', 'self').first.fetch('href') + raw.dig('links', 'self').first.fetch('href') end def clone_url diff --git a/lib/gitlab/bitbucket_server_import/project_creator.rb b/lib/gitlab/bitbucket_server_import/project_creator.rb index 031ae29120d..49b81b24856 100644 --- a/lib/gitlab/bitbucket_server_import/project_creator.rb +++ b/lib/gitlab/bitbucket_server_import/project_creator.rb @@ -22,7 +22,7 @@ module Gitlab namespace_id: namespace.id, visibility_level: repo.visibility_level, import_type: 'bitbucket_server', - import_source: repo.full_name, + import_source: repo.browse_url, import_url: repo.clone_url, import_data: { credentials: session_data,