Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
1ff1b6d8
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1ff1b6d8
编写于
2月 26, 2014
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5719 from jacob-carlborg/mr_target
By default, target original repository if it's a fork when creating new MR.
上级
93cdf8a3
9439cb55
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
22 addition
and
5 deletion
+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
未找到文件。
app/controllers/projects/merge_requests_controller.rb
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录