Commit df85dda5 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Merged heptapod-stable into support branch

--HG--
branch : heptapod-0-21
......@@ -21,6 +21,7 @@ spec/examples.txt
assets-hash.txt
app/assets/javascripts/locale/*/app.js
public/assets
public/uploads
builds/
shared/artifacts/
shared/lfs-objects/
......
......@@ -15,7 +15,7 @@ def initialize(user, params)
def vcs_type(params)
case params[:import_type]
# Same ordering as in _import_project_pane.html.haml
when :gitlab_project, :github, :bitbucket_server, :gitlab, :fogbugz, :gitea, :phabricator
when :github, :bitbucket_server, :gitlab, :fogbugz, :gitea, :phabricator
'git'
else
return @project.group.default_vcs_type unless @project.group.nil?
......@@ -36,6 +36,9 @@ def execute
@project = Project.new(params)
# in case `vcs_type` is given directly in params, it's already been
# applied by constructor. In some other cases (import from a Git-only forge),
# it can be derived from other params
@project.vcs_type = vcs_type(params) unless params.include?(:vcs_type)
@project.visibility_level = @project.group.visibility_level unless @project.visibility_level_allowed_by_group?
......
......@@ -71,11 +71,6 @@ def prepare_import_params
end
params[:import_data] = { data: data } if data.present?
# as of this writing we don't have any Mercurial project import
# capability. Will in particular be able to specify it upfront.
# Meanwhile, this fixes the import of Git projects, at least in RSpec
# tests:
params[:vcs_type] = "git"
end
end
end
......
......@@ -40,7 +40,7 @@ def execute
attr_accessor :archive_file, :current_user, :project, :shared
def restorers
[repo_restorer, wiki_restorer, project_tree, avatar_restorer, design_repo_restorer,
[vcs_type_restorer, repo_restorer, wiki_restorer, project_tree, avatar_restorer, design_repo_restorer,
uploads_restorer, lfs_restorer, statistics_restorer, snippets_repo_restorer]
end
......@@ -68,6 +68,10 @@ def sample_data_template?
project&.import_data&.data&.dig('sample_data')
end
def vcs_type_restorer
Gitlab::ImportExport::Project::VcsTypeRestorer.new(project: project, shared: shared, user: current_user)
end
def avatar_restorer
Gitlab::ImportExport::AvatarRestorer.new(project: project, shared: shared)
end
......
......@@ -44,7 +44,7 @@ def restore
false
end
private
protected
def relation_reader
strong_memoize(:relation_reader) do
......
# frozen_string_literal: true
module Gitlab
module ImportExport
module Project
class VcsTypeRestorer < TreeRestorer
# even though we don't need the `user` attribute,
# subclassing `initialize` is not in order, as it behaves badly with the
# monkey patching of `new` done by RSpec (call_original on TreeRestorer)
def restore
unless relation_reader
raise Gitlab::ImportExport::Error, 'invalid import format'
end
project_attributes = relation_reader.consume_attributes(importable_path)
# Using "git" default value to accept Git projects exported from a
# regular GitLab instance
@project.vcs_type = project_attributes.fetch("vcs_type", "git")
true
rescue => e
@shared.error(e)
false
end
end
end
end
end
......@@ -988,6 +988,7 @@ def bundle_to_disk(save_path)
hg_call(["bundle", "--all", hg_bundle_path(save_path)],
force_system_user: true)
backup_additional(save_path)
true
end
# Backup data (config and state) that is not part of the bundle
......
......@@ -63,6 +63,7 @@ else
"lib/gitlab/mercurial/*,"\
"lib/gitlab/*_access*,"\
"lib/gitlab/git/*,"\
"lib/gitlab/import_export/*,"\
"mailers/emails/pipelines,"\
"mailers/notify,"\
"models/application_setting,"\
......
......@@ -70,6 +70,8 @@ if CI_TAG or RELEASE_BRANCH_RX.match(CI_BRANCH):
sys.exit(0)
elif CI_BRANCH == 'heptapod-stable':
PYDEPS_BRANCH = 'stable'
elif CI_BRANCH == 'heptapod-oldstable':
PYDEPS_BRANCH = 'oldstable'
else:
PYDEPS_BRANCH = 'default'
......
......@@ -90,7 +90,7 @@
context 'without sample_data_template' do
it 'initializes the ProjectTree' do
expect(Gitlab::ImportExport::Project::TreeRestorer).to receive(:new).and_call_original
expect(Gitlab::ImportExport::Project::TreeRestorer).to receive(:new).twice.and_call_original
importer.execute
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment