Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
a64f1c76
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,体验更适合开发者的 AI 搜索 >>
提交
a64f1c76
编写于
4月 12, 2016
作者:
F
Felipe Artur
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add changelog entry, improve specs and model code
上级
476cf23f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
9 addition
and
14 deletion
+9
-14
CHANGELOG
CHANGELOG
+1
-0
app/models/merge_request.rb
app/models/merge_request.rb
+4
-9
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+4
-5
未找到文件。
CHANGELOG
浏览文件 @
a64f1c76
...
...
@@ -17,6 +17,7 @@ v 8.7.0 (unreleased)
- Add links to CI setup documentation from project settings and builds pages
- Handle nil descriptions in Slack issue messages (Stan Hu)
- Add default scope to projects to exclude projects pending deletion
- Allow to close merge requests which source projects(forks) are deleted.
- Ensure empty recipients are rejected in BuildsEmailService
- API: Ability to filter milestones by state `active` and `closed` (Robert Schilling)
- Implement 'Groups View' as an option for dashboard preferences !3379 (Elias W.)
...
...
app/models/merge_request.rb
浏览文件 @
a64f1c76
...
...
@@ -128,7 +128,7 @@ class MergeRequest < ActiveRecord::Base
validates
:target_project
,
presence:
true
validates
:target_branch
,
presence:
true
validates
:merge_user
,
presence:
true
,
if: :merge_when_build_succeeds?
validate
:validate_branches
validate
:validate_branches
,
unless: :allow_broken
validate
:validate_fork
scope
:by_branch
,
->
(
branch_name
)
{
where
(
"(source_branch LIKE :branch) OR (target_branch LIKE :branch)"
,
branch:
branch_name
)
}
...
...
@@ -213,14 +213,12 @@ class MergeRequest < ActiveRecord::Base
end
def
validate_branches
return
if
allow_broken
if
target_project
==
source_project
&&
target_branch
==
source_branch
errors
.
add
:branch_conflict
,
"You can not use same project/branch for source and target"
end
if
opened?
||
reopened?
similar_mrs
=
self
.
target_project
.
merge_requests
.
where
(
source_branch:
source_branch
,
target_branch:
target_branch
,
source_project_id:
source_project
.
id
).
opened
similar_mrs
=
self
.
target_project
.
merge_requests
.
where
(
source_branch:
source_branch
,
target_branch:
target_branch
,
source_project_id:
source_project
.
try
(
:id
)
).
opened
similar_mrs
=
similar_mrs
.
where
(
'id not in (?)'
,
self
.
id
)
if
self
.
id
if
similar_mrs
.
any?
errors
.
add
:validate_branches
,
...
...
@@ -346,12 +344,9 @@ class MergeRequest < ActiveRecord::Base
end
def
hook_attrs
source_hook_attrs
=
source_project
.
hook_attrs
if
source_project
.
present?
target_hook_attrs
=
target_project
.
hook_attrs
if
target_project
.
present?
attrs
=
{
source:
source_
hook_attrs
,
target:
target_hook_attrs
,
source:
source_
project
.
try
(
:hook_attrs
)
,
target:
target_
project
.
hook_attrs
,
last_commit:
nil
,
work_in_progress:
work_in_progress?
}
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
浏览文件 @
a64f1c76
...
...
@@ -159,19 +159,18 @@ describe Projects::MergeRequestsController do
describe
'PUT #update'
do
context
'there is no source project'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:fork_project
)
{
create
(
:forked_project_with_submodules
)
}
let
(
:merge_request
)
{
create
(
:merge_request
_with_diffs
,
source_project:
fork_project
,
source_branch:
'add-submodule-version-bump'
,
target_branch:
'master'
,
target_project:
project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:fork_project
)
{
create
(
:forked_project_with_submodules
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
fork_project
,
source_branch:
'add-submodule-version-bump'
,
target_branch:
'master'
,
target_project:
project
)
}
before
do
fork_project
.
build_forked_project_link
(
forked_to_project_id:
fork_project
.
id
,
forked_from_project_id:
project
.
id
)
fork_project
.
save
merge_request
.
reload
fork_project
.
destroy
end
it
'closes MR without errors'
do
fork_project
.
destroy
post
:update
,
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录