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
7c00b538
Commit
7c00b538
authored
Sep 21, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Find branches in all projects in the fork network
parent
70716a12
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
3 deletions
+25
-3
app/controllers/projects/merge_requests/creations_controller.rb
...ntrollers/projects/merge_requests/creations_controller.rb
+5
-2
app/finders/merge_request_target_project_finder.rb
app/finders/merge_request_target_project_finder.rb
+1
-1
spec/features/merge_requests/create_new_mr_from_fork_spec.rb
spec/features/merge_requests/create_new_mr_from_fork_spec.rb
+19
-0
No files found.
app/controllers/projects/merge_requests/creations_controller.rb
View file @
7c00b538
...
...
@@ -120,10 +120,13 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap
end
def
selected_target_project
if
@project
.
id
.
to_s
==
params
[
:target_project_id
]
||
@project
.
forked_project_link
.
nil
?
if
@project
.
id
.
to_s
==
params
[
:target_project_id
]
||
!
@project
.
forked
?
@project
elsif
params
[
:target_project_id
].
present?
MergeRequestTargetProjectFinder
.
new
(
current_user:
current_user
,
source_project:
@project
)
.
execute
.
find
(
params
[
:target_project_id
])
else
@project
.
forked_
project_link
.
forked_
from_project
@project
.
forked_from_project
end
end
end
app/finders/merge_request_target_project_finder.rb
View file @
7c00b538
class
MergeRequestTargetProjectFinder
attr_reader
:current_user
,
:source_project
def
initialize
(
current_user:
nil
,
source_project
:
,
params:
{}
)
def
initialize
(
current_user:
nil
,
source_project
:)
@current_user
=
current_user
@source_project
=
source_project
end
...
...
spec/features/merge_requests/create_new_mr_from_fork_spec.rb
View file @
7c00b538
...
...
@@ -44,6 +44,25 @@ feature 'Creating a merge request from a fork', :js do
expect
{
click_button
'Submit merge request'
}
.
to
change
{
target_project
.
merge_requests
.
reload
.
size
}.
by
(
1
)
end
it
'updates the branches when selecting a new target project'
do
target_project_member
=
target_project
.
owner
CreateBranchService
.
new
(
target_project
,
target_project_member
)
.
execute
(
'a-brand-new-branch-to-test'
,
'master'
)
visit
project_new_merge_request_path
(
source_project
)
first
(
'.js-target-project'
).
click
find
(
'.dropdown-target-project .dropdown-content a'
,
text:
target_project
.
full_path
).
click
wait_for_requests
first
(
'.js-target-branch'
).
click
within
(
'.dropdown-target-branch .dropdown-content'
)
do
expect
(
page
).
to
have_content
(
'a-brand-new-branch-to-test'
)
end
end
end
context
'creating to the source of a fork'
do
...
...
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