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
76efdea7
Commit
76efdea7
authored
Mar 11, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing MR issues with import
parent
1d8e02c4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
2 deletions
+10
-2
app/models/merge_request.rb
app/models/merge_request.rb
+3
-1
app/services/projects/import_export/project_tree_restorer.rb
app/services/projects/import_export/project_tree_restorer.rb
+1
-1
app/services/projects/import_export/relation_factory.rb
app/services/projects/import_export/relation_factory.rb
+6
-0
No files found.
app/models/merge_request.rb
View file @
76efdea7
...
...
@@ -50,6 +50,8 @@ class MergeRequest < ActiveRecord::Base
delegate
:commits
,
:diffs
,
:real_size
,
to: :merge_request_diff
,
prefix:
nil
attr_accessor
:importing
# When this attribute is true some MR validation is ignored
# It allows us to close or modify broken merge requests
attr_accessor
:allow_broken
...
...
@@ -128,7 +130,7 @@ class MergeRequest < ActiveRecord::Base
validates
:target_project
,
presence:
true
validates
:target_branch
,
presence:
true
validates
:merge_user
,
presence:
true
,
if: :merge_when_build_succeeds?
validate
:validate_branches
validate
:validate_branches
,
unless: :importing
validate
:validate_fork
scope
:of_group
,
->
(
group
)
{
where
(
"source_project_id in (:group_project_ids) OR target_project_id in (:group_project_ids)"
,
group_project_ids:
group
.
projects
.
select
(
:id
).
reorder
(
nil
))
}
...
...
app/services/projects/import_export/project_tree_restorer.rb
View file @
76efdea7
...
...
@@ -44,7 +44,7 @@ module Projects
def
create_relation
(
relation
,
relation_hash_list
)
relation_hash_list
.
map
do
|
relation_hash
|
Projects
::
ImportExport
::
RelationFactory
.
create
(
relation_sym:
relation
,
relation_hash:
relation_hash
.
merge
(
project_id:
project
.
id
),
members_map:
members_map
)
relation_sym:
relation
,
relation_hash:
relation_hash
.
merge
(
'project_id'
=>
project
.
id
),
members_map:
members_map
)
end
end
end
...
...
app/services/projects/import_export/relation_factory.rb
View file @
76efdea7
...
...
@@ -10,6 +10,12 @@ module Projects
relation_sym
=
parse_relation_sym
(
relation_sym
)
klass
=
relation_class
(
relation_sym
)
relation_hash
.
delete
(
'id'
)
#screw IDs for now
#TODO refactor this...
if
relation_sym
==
:merge_requests
relation_hash
[
'target_project_id'
]
=
relation_hash
.
delete
(
'project_id'
)
relation_hash
[
'source_project_id'
]
=
-
1
relation_hash
[
'importing'
]
=
true
end
update_user_references
(
relation_hash
,
members_map
)
klass
.
new
(
relation_hash
)
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