Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1a2ed3d4
Commit
1a2ed3d4
authored
Feb 21, 2020
by
Francisco Javier López
Committed by
Stan Hu
Feb 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove temporal fix for import/export
parent
fd486c93
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
2 additions
and
52 deletions
+2
-52
lib/gitlab/import_export/base_relation_factory.rb
lib/gitlab/import_export/base_relation_factory.rb
+1
-2
lib/gitlab/import_export/project_relation_factory.rb
lib/gitlab/import_export/project_relation_factory.rb
+0
-24
lib/gitlab/import_export/relation_tree_restorer.rb
lib/gitlab/import_export/relation_tree_restorer.rb
+1
-22
spec/lib/gitlab/import_export/base_relation_factory_spec.rb
spec/lib/gitlab/import_export/base_relation_factory_spec.rb
+0
-2
spec/lib/gitlab/import_export/project_relation_factory_spec.rb
...lib/gitlab/import_export/project_relation_factory_spec.rb
+0
-2
No files found.
lib/gitlab/import_export/base_relation_factory.rb
View file @
1a2ed3d4
...
...
@@ -43,12 +43,11 @@ module Gitlab
relation_name
.
to_s
.
constantize
end
def
initialize
(
relation_sym
:,
relation_hash
:,
members_mapper
:,
object_builder
:,
merge_requests_mapping:
nil
,
user
:,
importable
:,
excluded_keys:
[])
def
initialize
(
relation_sym
:,
relation_hash
:,
members_mapper
:,
object_builder
:,
user
:,
importable
:,
excluded_keys:
[])
@relation_name
=
self
.
class
.
overrides
[
relation_sym
]
&
.
to_sym
||
relation_sym
@relation_hash
=
relation_hash
.
except
(
'noteable_id'
)
@members_mapper
=
members_mapper
@object_builder
=
object_builder
@merge_requests_mapping
=
merge_requests_mapping
@user
=
user
@importable
=
importable
@imported_object_retries
=
0
...
...
lib/gitlab/import_export/project_relation_factory.rb
View file @
1a2ed3d4
...
...
@@ -111,28 +111,6 @@ module Gitlab
@relation_hash
[
'group_id'
]
=
@importable
.
namespace_id
end
# This code is a workaround for broken project exports that don't
# export merge requests with CI pipelines (i.e. exports that were
# generated from
# https://gitlab.com/gitlab-org/gitlab/merge_requests/17844).
# This method can be removed in GitLab 12.6.
def
update_merge_request_references
# If a merge request was properly created, we don't need to fix
# up this export.
return
if
@relation_hash
[
'merge_request'
]
merge_request_id
=
@relation_hash
[
'merge_request_id'
]
return
unless
merge_request_id
new_merge_request_id
=
@merge_requests_mapping
[
merge_request_id
]
return
unless
new_merge_request_id
@relation_hash
[
'merge_request_id'
]
=
new_merge_request_id
parsed_relation_hash
[
'merge_request_id'
]
=
new_merge_request_id
end
def
setup_build
@relation_hash
.
delete
(
'trace'
)
# old export files have trace
@relation_hash
.
delete
(
'token'
)
...
...
@@ -147,8 +125,6 @@ module Gitlab
end
def
setup_pipeline
update_merge_request_references
@relation_hash
.
fetch
(
'stages'
,
[]).
each
do
|
stage
|
stage
.
statuses
.
each
do
|
status
|
status
.
pipeline
=
imported_object
...
...
lib/gitlab/import_export/relation_tree_restorer.rb
View file @
1a2ed3d4
...
...
@@ -76,8 +76,6 @@ module Gitlab
import_failure_service
.
with_retry
(
action:
'relation_object.save!'
,
relation_key:
relation_key
,
relation_index:
relation_index
)
do
relation_object
.
save!
end
save_id_mapping
(
relation_key
,
data_hash
,
relation_object
)
rescue
=>
e
import_failure_service
.
log_import_failure
(
source:
'process_relation_item!'
,
...
...
@@ -90,17 +88,6 @@ module Gitlab
@import_failure_service
||=
ImportFailureService
.
new
(
@importable
)
end
# Older, serialized CI pipeline exports may only have a
# merge_request_id and not the full hash of the merge request. To
# import these pipelines, we need to preserve the mapping between
# the old and new the merge request ID.
def
save_id_mapping
(
relation_key
,
data_hash
,
relation_object
)
return
unless
importable_class
==
Project
return
unless
relation_key
==
'merge_requests'
merge_requests_mapping
[
data_hash
[
'id'
]]
=
relation_object
.
id
end
def
relations
@relations
||=
@reader
...
...
@@ -219,13 +206,8 @@ module Gitlab
importable_class
.
to_s
.
downcase
.
to_sym
end
# A Hash of the imported merge request ID -> imported ID.
def
merge_requests_mapping
@merge_requests_mapping
||=
{}
end
def
relation_factory_params
(
relation_key
,
data_hash
)
base_params
=
{
{
relation_sym:
relation_key
.
to_sym
,
relation_hash:
data_hash
,
importable:
@importable
,
...
...
@@ -234,9 +216,6 @@ module Gitlab
user:
@user
,
excluded_keys:
excluded_keys_for_relation
(
relation_key
)
}
base_params
[
:merge_requests_mapping
]
=
merge_requests_mapping
if
importable_class
==
Project
base_params
end
end
end
...
...
spec/lib/gitlab/import_export/base_relation_factory_spec.rb
View file @
1a2ed3d4
...
...
@@ -7,7 +7,6 @@ describe Gitlab::ImportExport::BaseRelationFactory do
let
(
:project
)
{
create
(
:project
)
}
let
(
:members_mapper
)
{
double
(
'members_mapper'
).
as_null_object
}
let
(
:relation_sym
)
{
:project_snippets
}
let
(
:merge_requests_mapping
)
{
{}
}
let
(
:relation_hash
)
{
{}
}
let
(
:excluded_keys
)
{
[]
}
...
...
@@ -16,7 +15,6 @@ describe Gitlab::ImportExport::BaseRelationFactory do
relation_hash:
relation_hash
,
object_builder:
Gitlab
::
ImportExport
::
GroupProjectObjectBuilder
,
members_mapper:
members_mapper
,
merge_requests_mapping:
merge_requests_mapping
,
user:
user
,
importable:
project
,
excluded_keys:
excluded_keys
)
...
...
spec/lib/gitlab/import_export/project_relation_factory_spec.rb
View file @
1a2ed3d4
...
...
@@ -6,7 +6,6 @@ describe Gitlab::ImportExport::ProjectRelationFactory do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
group:
group
)
}
let
(
:members_mapper
)
{
double
(
'members_mapper'
).
as_null_object
}
let
(
:merge_requests_mapping
)
{
{}
}
let
(
:user
)
{
create
(
:admin
)
}
let
(
:excluded_keys
)
{
[]
}
let
(
:created_object
)
do
...
...
@@ -14,7 +13,6 @@ describe Gitlab::ImportExport::ProjectRelationFactory do
relation_hash:
relation_hash
,
object_builder:
Gitlab
::
ImportExport
::
GroupProjectObjectBuilder
,
members_mapper:
members_mapper
,
merge_requests_mapping:
merge_requests_mapping
,
user:
user
,
importable:
project
,
excluded_keys:
excluded_keys
)
...
...
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