BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
1ff1b6d8
Commit
1ff1b6d8
authored
Feb 26, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5719 from jacob-carlborg/mr_target
By default, target original repository if it's a fork when creating new MR.
parents
93cdf8a3
9439cb55
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
5 deletions
+23
-5
merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+5
-1
merge_requests_helper.rb
app/helpers/merge_requests_helper.rb
+2
-1
_form.html.haml
app/views/projects/merge_requests/_form.html.haml
+1
-1
forked_merge_requests.feature
features/project/forked_merge_requests.feature
+7
-0
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 @
1ff1b6d8
...
...
@@ -60,7 +60,11 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def
new
@merge_request
=
MergeRequest
.
new
(
params
[
:merge_request
])
@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
@merge_request
end
...
...
app/helpers/merge_requests_helper.rb
View file @
1ff1b6d8
module
MergeRequestsHelper
def
new_mr_path_from_push_event
(
event
)
target_project
=
event
.
project
.
forked_from_project
||
event
.
project
new_project_merge_request_path
(
event
.
project
,
new_mr_from_push_event
(
event
,
event
.
project
)
new_mr_from_push_event
(
event
,
target_
project
)
)
end
...
...
app/views/projects/merge_requests/_form.html.haml
View file @
1ff1b6d8
...
...
@@ -25,7 +25,7 @@
.clearfix
.pull-left
-
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
=
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 @
1ff1b6d8
...
...
@@ -32,3 +32,9 @@ Feature: Project Forked Merge Requests
And
I fill out an invalid
"Merge Request On Forked Project"
merge request
And
I submit the merge request
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 @
1ff1b6d8
...
...
@@ -159,8 +159,11 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
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
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_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_target_branch"
,
{}).
value
.
should
==
""
end
...
...
@@ -168,7 +171,10 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
step
'I should see validation errors'
do
page
.
should
have_content
"Source 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
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