Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
391b8cfecdb4
Commit
df85dda5
authored
May 20, 2021
by
Georges Racinet
🦑
Browse files
Merged heptapod-stable into support branch
--HG-- branch : heptapod-0-21
parents
f000c759add6
063527e2f230
Changes
10
Hide whitespace changes
Inline
Side-by-side
.hgignore
View file @
391b8cfe
...
...
@@ -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/
...
...
app/services/projects/create_service.rb
View file @
391b8cfe
...
...
@@ -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?
...
...
app/services/projects/gitlab_projects_import_service.rb
View file @
391b8cfe
...
...
@@ -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
...
...
lib/gitlab/import_export/importer.rb
View file @
391b8cfe
...
...
@@ -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
...
...
lib/gitlab/import_export/project/tree_restorer.rb
View file @
391b8cfe
...
...
@@ -44,7 +44,7 @@ def restore
false
end
pr
ivate
pr
otected
def
relation_reader
strong_memoize
(
:relation_reader
)
do
...
...
lib/gitlab/import_export/project/vcs_type_restorer.rb
0 → 100644
View file @
391b8cfe
# 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
lib/gitlab/mercurial/hg_git_repository.rb
View file @
391b8cfe
...
...
@@ -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
...
...
scripts/heptapod_knapsack.sh
View file @
391b8cfe
...
...
@@ -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,"
\
...
...
scripts/hgitaly-test-build
View file @
391b8cfe
...
...
@@ -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'
...
...
spec/lib/gitlab/import_export/importer_spec.rb
View file @
391b8cfe
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment