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
fb9bd552
Commit
fb9bd552
authored
Aug 21, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix fork MRs importing issue
parent
646aae3e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
2 deletions
+21
-2
lib/gitlab/import_export/import_export.yml
lib/gitlab/import_export/import_export.yml
+2
-0
lib/gitlab/import_export/merge_request_parser.rb
lib/gitlab/import_export/merge_request_parser.rb
+1
-1
spec/lib/gitlab/import_export/project.json
spec/lib/gitlab/import_export/project.json
+4
-1
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
+4
-0
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
+10
-0
No files found.
lib/gitlab/import_export/import_export.yml
View file @
fb9bd552
...
@@ -133,5 +133,7 @@ methods:
...
@@ -133,5 +133,7 @@ methods:
-
:utf8_diff
-
:utf8_diff
merge_requests
:
merge_requests
:
-
:diff_head_sha
-
:diff_head_sha
-
:source_branch_sha
-
:target_branch_sha
project
:
project
:
-
:description_html
-
:description_html
lib/gitlab/import_export/merge_request_parser.rb
View file @
fb9bd552
...
@@ -30,7 +30,7 @@ module Gitlab
...
@@ -30,7 +30,7 @@ module Gitlab
end
end
def
branch_exists?
(
branch_name
)
def
branch_exists?
(
branch_name
)
@project
.
repository
.
branch_exists?
(
branch_name
)
@project
.
repository
.
raw
.
branch_exists?
(
branch_name
)
end
end
def
fork_merge_request?
def
fork_merge_request?
...
...
spec/lib/gitlab/import_export/project.json
View file @
fb9bd552
...
@@ -2522,7 +2522,7 @@
...
@@ -2522,7 +2522,7 @@
"id"
:
27
,
"id"
:
27
,
"target_branch"
:
"feature"
,
"target_branch"
:
"feature"
,
"source_branch"
:
"feature_conflict"
,
"source_branch"
:
"feature_conflict"
,
"source_project_id"
:
5
,
"source_project_id"
:
999
,
"author_id"
:
1
,
"author_id"
:
1
,
"assignee_id"
:
null
,
"assignee_id"
:
null
,
"title"
:
"MR1"
,
"title"
:
"MR1"
,
...
@@ -2536,6 +2536,9 @@
...
@@ -2536,6 +2536,9 @@
"position"
:
0
,
"position"
:
0
,
"updated_by_id"
:
null
,
"updated_by_id"
:
null
,
"merge_error"
:
null
,
"merge_error"
:
null
,
"diff_head_sha"
:
"HEAD"
,
"source_branch_sha"
:
"ABCD"
,
"target_branch_sha"
:
"DCBA"
,
"merge_params"
:
{
"merge_params"
:
{
"force_remove_source_branch"
:
null
"force_remove_source_branch"
:
null
},
},
...
...
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
View file @
fb9bd552
...
@@ -10,6 +10,10 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
...
@@ -10,6 +10,10 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
@shared
=
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
""
,
project_path:
'path'
)
@shared
=
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
""
,
project_path:
'path'
)
allow
(
@shared
).
to
receive
(
:export_path
).
and_return
(
'spec/lib/gitlab/import_export/'
)
allow
(
@shared
).
to
receive
(
:export_path
).
and_return
(
'spec/lib/gitlab/import_export/'
)
@project
=
create
(
:project
,
:builds_disabled
,
:issues_disabled
,
name:
'project'
,
path:
'project'
)
@project
=
create
(
:project
,
:builds_disabled
,
:issues_disabled
,
name:
'project'
,
path:
'project'
)
allow
(
@project
.
repository
).
to
receive
(
:fetch_ref
).
and_return
(
true
)
expect
(
@project
.
repository
).
to
receive
(
:create_branch
).
with
(
'feature'
,
'DCBA'
)
project_tree_restorer
=
described_class
.
new
(
user:
@user
,
shared:
@shared
,
project:
@project
)
project_tree_restorer
=
described_class
.
new
(
user:
@user
,
shared:
@shared
,
project:
@project
)
@restored_project_json
=
project_tree_restorer
.
restore
@restored_project_json
=
project_tree_restorer
.
restore
end
end
...
...
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
View file @
fb9bd552
...
@@ -11,6 +11,8 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
...
@@ -11,6 +11,8 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
before
do
before
do
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
allow_any_instance_of
(
Gitlab
::
ImportExport
).
to
receive
(
:storage_path
).
and_return
(
export_path
)
allow_any_instance_of
(
Gitlab
::
ImportExport
).
to
receive
(
:storage_path
).
and_return
(
export_path
)
allow_any_instance_of
(
MergeRequest
).
to
receive
(
:source_branch_sha
).
and_return
(
'ABCD'
)
allow_any_instance_of
(
MergeRequest
).
to
receive
(
:target_branch_sha
).
and_return
(
'DCBA'
)
end
end
after
do
after
do
...
@@ -43,6 +45,14 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
...
@@ -43,6 +45,14 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
expect
(
saved_project_json
[
'merge_requests'
].
first
[
'milestone'
]).
not_to
be_empty
expect
(
saved_project_json
[
'merge_requests'
].
first
[
'milestone'
]).
not_to
be_empty
end
end
it
'has merge request\'s source branch SHA'
do
expect
(
saved_project_json
[
'merge_requests'
].
first
[
'source_branch_sha'
]).
to
eq
(
'ABCD'
)
end
it
'has merge request\'s target branch SHA'
do
expect
(
saved_project_json
[
'merge_requests'
].
first
[
'target_branch_sha'
]).
to
eq
(
'DCBA'
)
end
it
'has events'
do
it
'has events'
do
expect
(
saved_project_json
[
'merge_requests'
].
first
[
'milestone'
][
'events'
]).
not_to
be_empty
expect
(
saved_project_json
[
'merge_requests'
].
first
[
'milestone'
][
'events'
]).
not_to
be_empty
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