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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
da60baf2
Commit
da60baf2
authored
Apr 12, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing more importing issues
parent
56fc5893
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
app/models/merge_request_diff.rb
app/models/merge_request_diff.rb
+3
-1
app/services/projects/import_export/project_tree_restorer.rb
app/services/projects/import_export/project_tree_restorer.rb
+2
-1
app/services/projects/import_export/relation_factory.rb
app/services/projects/import_export/relation_factory.rb
+3
-2
No files found.
app/models/merge_request_diff.rb
View file @
da60baf2
...
@@ -37,7 +37,9 @@ class MergeRequestDiff < ActiveRecord::Base
...
@@ -37,7 +37,9 @@ class MergeRequestDiff < ActiveRecord::Base
serialize
:st_commits
serialize
:st_commits
serialize
:st_diffs
serialize
:st_diffs
after_create
:reload_content
after_create
:reload_content
,
unless: :importing
attr_accessor
:importing
def
reload_content
def
reload_content
reload_commits
reload_commits
...
...
app/services/projects/import_export/project_tree_restorer.rb
View file @
da60baf2
...
@@ -71,9 +71,10 @@ module Projects
...
@@ -71,9 +71,10 @@ module Projects
# TODO refactor this
# TODO refactor this
relation_key
=
relation
.
keys
.
first
relation_key
=
relation
.
keys
.
first
tree_hash
[
relation_key
.
to_s
].
each
do
|
relation_item
|
tree_hash
[
relation_key
.
to_s
].
each
do
|
relation_item
|
relation
.
values
.
each
do
|
sub_relation
|
relation
.
values
.
flatten
.
each
do
|
sub_relation
|
relation_hash
=
relation_item
[
sub_relation
.
to_s
]
relation_hash
=
relation_item
[
sub_relation
.
to_s
]
next
if
relation_hash
.
blank?
next
if
relation_hash
.
blank?
relation_hash
.
merge!
(
'project_id'
=>
project
.
id
)
if
sub_relation
==
:merge_requests
sub_relation_object
=
Projects
::
ImportExport
::
RelationFactory
.
create
(
sub_relation_object
=
Projects
::
ImportExport
::
RelationFactory
.
create
(
relation_sym:
sub_relation
,
relation_hash:
relation_hash
,
members_map:
members_map
)
relation_sym:
sub_relation
,
relation_hash:
relation_hash
,
members_map:
members_map
)
relation_item
[
sub_relation
.
to_s
]
=
sub_relation_object
relation_item
[
sub_relation
.
to_s
]
=
sub_relation_object
...
...
app/services/projects/import_export/relation_factory.rb
View file @
da60baf2
...
@@ -7,12 +7,14 @@ module Projects
...
@@ -7,12 +7,14 @@ module Projects
USER_REFERENCES
=
%w(author_id assignee_id updated_by_id)
.
freeze
USER_REFERENCES
=
%w(author_id assignee_id updated_by_id)
.
freeze
def
create
(
relation_sym
:,
relation_hash
:,
members_map
:)
def
create
(
relation_sym
:,
relation_hash
:,
members_map
:)
#TODO refactor this
relation_sym
=
parse_relation_sym
(
relation_sym
)
relation_sym
=
parse_relation_sym
(
relation_sym
)
klass
=
relation_class
(
relation_sym
)
klass
=
relation_class
(
relation_sym
)
relation_hash
.
delete
(
'id'
)
#screw IDs for now
relation_hash
.
delete
(
'id'
)
#screw IDs for now
handle_merge_requests
(
relation_hash
)
if
relation_sym
==
:merge_requests
handle_merge_requests
(
relation_hash
)
if
relation_sym
==
:merge_requests
update_user_references
(
relation_hash
,
members_map
)
update_user_references
(
relation_hash
,
members_map
)
klass
.
new
(
relation_hash
)
imported_object
=
klass
.
new
(
relation_hash
)
imported_object
.
importing
=
true
if
imported_object
.
respond_to?
(
:importing
)
end
end
private
private
...
@@ -20,7 +22,6 @@ module Projects
...
@@ -20,7 +22,6 @@ module Projects
def
handle_merge_requests
(
relation_hash
)
def
handle_merge_requests
(
relation_hash
)
relation_hash
[
'target_project_id'
]
=
relation_hash
.
delete
(
'project_id'
)
relation_hash
[
'target_project_id'
]
=
relation_hash
.
delete
(
'project_id'
)
relation_hash
[
'source_project_id'
]
=
-
1
relation_hash
[
'source_project_id'
]
=
-
1
relation_hash
[
'importing'
]
=
true
end
end
#TODO nice to have, optimize this to only get called for specific models
#TODO nice to have, optimize this to only get called for specific models
...
...
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