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
f8e85479
Commit
f8e85479
authored
Aug 05, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix MR source project assignment
parent
551ffc0a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
9 deletions
+34
-9
CHANGELOG
CHANGELOG
+1
-0
lib/gitlab/import_export/relation_factory.rb
lib/gitlab/import_export/relation_factory.rb
+8
-6
spec/lib/gitlab/import_export/project.json
spec/lib/gitlab/import_export/project.json
+3
-3
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
+22
-0
No files found.
CHANGELOG
View file @
f8e85479
...
...
@@ -82,6 +82,7 @@ v 8.11.0 (unreleased)
- Adds support for pending invitation project members importing projects
- Update devise initializer to turn on changed password notification emails. !5648 (tombell)
- Avoid to show the original password field when password is automatically set. !5712 (duduribeiro)
- Fix importing GitLab projects with an invalid MR source project
v 8.10.5 (unreleased)
...
...
lib/gitlab/import_export/relation_factory.rb
View file @
f8e85479
...
...
@@ -102,17 +102,19 @@ module Gitlab
def
update_project_references
project_id
=
@relation_hash
.
delete
(
'project_id'
)
# If source and target are the same, populate them with the new project ID.
if
@relation_hash
[
'source_project_id'
]
@relation_hash
[
'source_project_id'
]
=
same_source_and_target?
?
project_id
:
-
1
end
# project_id may not be part of the export, but we always need to populate it if required.
@relation_hash
[
'project_id'
]
=
project_id
@relation_hash
[
'gl_project_id'
]
=
project_id
if
@relation_hash
[
'gl_project_id'
]
@relation_hash
[
'target_project_id'
]
=
project_id
if
@relation_hash
[
'target_project_id'
]
@relation_hash
[
'source_project_id'
]
=
-
1
if
@relation_hash
[
'source_project_id'
]
end
# If source and target are the same, populate them with the new project ID.
if
@relation_hash
[
'source_project_id'
]
&&
@relation_hash
[
'target_project_id'
]
&&
@relation_hash
[
'target_project_id'
]
==
@relation_hash
[
'source_project_id'
]
@relation_hash
[
'source_project_id'
]
=
project_id
end
def
same_source_and_target?
@relation_hash
[
'target_project_id'
]
&&
@relation_hash
[
'target_project_id'
]
==
@relation_hash
[
'source_project_id'
]
end
def
reset_ci_tokens
...
...
spec/lib/gitlab/import_export/project.json
View file @
f8e85479
...
...
@@ -2393,7 +2393,7 @@
"source_project_id"
:
5
,
"author_id"
:
1
,
"assignee_id"
:
null
,
"title"
:
"
Cannot be automatically merged
"
,
"title"
:
"
MR1
"
,
"created_at"
:
"2016-06-14T15:02:36.568Z"
,
"updated_at"
:
"2016-06-14T15:02:56.815Z"
,
"state"
:
"opened"
,
...
...
@@ -2827,10 +2827,10 @@
"id"
:
26
,
"target_branch"
:
"master"
,
"source_branch"
:
"feature"
,
"source_project_id"
:
5
,
"source_project_id"
:
4
,
"author_id"
:
1
,
"assignee_id"
:
null
,
"title"
:
"
Can be automatically merged
"
,
"title"
:
"
MR2
"
,
"created_at"
:
"2016-06-14T15:02:36.418Z"
,
"updated_at"
:
"2016-06-14T15:02:57.013Z"
,
"state"
:
"opened"
,
...
...
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
View file @
f8e85479
...
...
@@ -71,6 +71,28 @@ describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do
expect
(
Milestone
.
find_by_description
(
'test milestone'
).
issues
).
not_to
be_empty
end
context
'Merge requests'
do
before
do
restored_project_json
end
it
'always has the new project as a target'
do
expect
(
MergeRequest
.
find_by_title
(
'MR1'
).
target_project
).
to
eq
(
project
)
end
it
'has the same source project as originally if source/target are the same'
do
expect
(
MergeRequest
.
find_by_title
(
'MR1'
).
source_project
).
to
eq
(
project
)
end
it
'has the new project as target if source/target differ'
do
expect
(
MergeRequest
.
find_by_title
(
'MR2'
).
target_project
).
to
eq
(
project
)
end
it
'has no source if source/target differ'
do
expect
(
MergeRequest
.
find_by_title
(
'MR2'
).
source_project_id
).
to
eq
(
-
1
)
end
end
end
end
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