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
Tatuya Kamada
gitlab-ce
Commits
9439cb55
Commit
9439cb55
authored
Nov 28, 2013
by
Jacob Carlborg
Committed by
Jacob Carlborg
Feb 24, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
By default, target original repository if fork when creating new MR.
parent
504777ec
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
5 deletions
+22
-5
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+5
-1
app/helpers/merge_requests_helper.rb
app/helpers/merge_requests_helper.rb
+2
-1
app/views/projects/merge_requests/_form.html.haml
app/views/projects/merge_requests/_form.html.haml
+1
-1
features/project/forked_merge_requests.feature
features/project/forked_merge_requests.feature
+6
-0
features/steps/project/project_forked_merge_requests.rb
features/steps/project/project_forked_merge_requests.rb
+8
-2
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
9439cb55
...
@@ -60,7 +60,11 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -60,7 +60,11 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def
new
def
new
@merge_request
=
MergeRequest
.
new
(
params
[
:merge_request
])
@merge_request
=
MergeRequest
.
new
(
params
[
:merge_request
])
@merge_request
.
source_project
=
@project
unless
@merge_request
.
source_project
@merge_request
.
source_project
=
@project
unless
@merge_request
.
source_project
@merge_request
.
target_project
=
@project
unless
@merge_request
.
target_project
@merge_request
.
target_project
||=
(
@project
.
forked_from_project
||
@project
)
@target_branches
=
@merge_request
.
target_project
.
nil?
?
[]
:
@merge_request
.
target_project
.
repository
.
branch_names
@merge_request
.
target_branch
||=
@merge_request
.
target_project
.
default_branch
@source_project
=
@merge_request
.
source_project
@source_project
=
@merge_request
.
source_project
@merge_request
@merge_request
end
end
...
...
app/helpers/merge_requests_helper.rb
View file @
9439cb55
module
MergeRequestsHelper
module
MergeRequestsHelper
def
new_mr_path_from_push_event
(
event
)
def
new_mr_path_from_push_event
(
event
)
target_project
=
event
.
project
.
forked_from_project
||
event
.
project
new_project_merge_request_path
(
new_project_merge_request_path
(
event
.
project
,
event
.
project
,
new_mr_from_push_event
(
event
,
event
.
project
)
new_mr_from_push_event
(
event
,
target_
project
)
)
)
end
end
...
...
app/views/projects/merge_requests/_form.html.haml
View file @
9439cb55
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
.clearfix
.clearfix
.pull-left
.pull-left
-
projects
=
@project
.
forked_from_project
.
nil?
?
[
@project
]
:
[
@project
,
@project
.
forked_from_project
]
-
projects
=
@project
.
forked_from_project
.
nil?
?
[
@project
]
:
[
@project
,
@project
.
forked_from_project
]
=
f
.
select
(
:target_project_id
,
options_from_collection_for_select
(
projects
,
'id'
,
'path_with_namespace'
),
{},
{
class:
'target_project select2 span3'
,
disabled:
@merge_request
.
persisted?
})
=
f
.
select
(
:target_project_id
,
options_from_collection_for_select
(
projects
,
'id'
,
'path_with_namespace'
,
f
.
object
.
target_project_id
),
{},
{
class:
'target_project select2 span3'
,
disabled:
@merge_request
.
persisted?
})
.pull-left
.pull-left
=
f
.
select
(
:target_branch
,
@merge_request
.
target_branches
,
{
include_blank:
"Select branch"
},
{
class:
'target_branch select2 span2'
})
=
f
.
select
(
:target_branch
,
@merge_request
.
target_branches
,
{
include_blank:
"Select branch"
},
{
class:
'target_branch select2 span2'
})
...
...
features/project/forked_merge_requests.feature
View file @
9439cb55
...
@@ -32,3 +32,9 @@ Feature: Project Forked Merge Requests
...
@@ -32,3 +32,9 @@ Feature: Project Forked Merge Requests
And
I fill out an invalid
"Merge Request On Forked Project"
merge request
And
I fill out an invalid
"Merge Request On Forked Project"
merge request
And
I submit the merge request
And
I submit the merge request
Then
I should see validation errors
Then
I should see validation errors
@javascript
Scenario
:
Merge request should target fork repository by default
Given
I visit project
"Forked Shop"
merge requests page
And
I click link
"New Merge Request"
Then
the target repository should be the original repository
\ No newline at end of file
features/steps/project/project_forked_merge_requests.rb
View file @
9439cb55
...
@@ -159,8 +159,11 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
...
@@ -159,8 +159,11 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
step
'I fill out an invalid "Merge Request On Forked Project" merge request'
do
step
'I fill out an invalid "Merge Request On Forked Project" merge request'
do
#If this isn't filled in the rest of the validations won't be triggered
#If this isn't filled in the rest of the validations won't be triggered
fill_in
"merge_request_title"
,
with:
"Merge Request On Forked Project"
fill_in
"merge_request_title"
,
with:
"Merge Request On Forked Project"
select
"Select branch"
,
from:
"merge_request_target_branch"
find
(
:select
,
"merge_request_source_project_id"
,
{}).
value
.
should
==
@forked_project
.
id
.
to_s
find
(
:select
,
"merge_request_source_project_id"
,
{}).
value
.
should
==
@forked_project
.
id
.
to_s
find
(
:select
,
"merge_request_target_project_id"
,
{}).
value
.
should
==
@forked_
project
.
id
.
to_s
find
(
:select
,
"merge_request_target_project_id"
,
{}).
value
.
should
==
project
.
id
.
to_s
find
(
:select
,
"merge_request_source_branch"
,
{}).
value
.
should
==
""
find
(
:select
,
"merge_request_source_branch"
,
{}).
value
.
should
==
""
find
(
:select
,
"merge_request_target_branch"
,
{}).
value
.
should
==
""
find
(
:select
,
"merge_request_target_branch"
,
{}).
value
.
should
==
""
end
end
...
@@ -168,7 +171,10 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
...
@@ -168,7 +171,10 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
step
'I should see validation errors'
do
step
'I should see validation errors'
do
page
.
should
have_content
"Source branch can't be blank"
page
.
should
have_content
"Source branch can't be blank"
page
.
should
have_content
"Target branch can't be blank"
page
.
should
have_content
"Target branch can't be blank"
page
.
should
have_content
"Branch conflict You can not use same project/branch for source and target"
end
step
'the target repository should be the original repository'
do
page
.
should
have_select
(
"merge_request_target_project_id"
,
selected:
project
.
path_with_namespace
)
end
end
def
project
def
project
...
...
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