Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
0385cd5a
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,发现更多精彩内容 >>
提交
0385cd5a
编写于
4月 13, 2016
作者:
Z
Zeger-Jan van de Weg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Start with iid on branch creation
上级
c0678f2d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
17 addition
and
10 deletion
+17
-10
app/models/issue.rb
app/models/issue.rb
+2
-2
app/services/merge_requests/build_service.rb
app/services/merge_requests/build_service.rb
+1
-1
app/services/system_note_service.rb
app/services/system_note_service.rb
+1
-1
doc/workflow/web_editor.md
doc/workflow/web_editor.md
+1
-1
spec/models/issue_spec.rb
spec/models/issue_spec.rb
+12
-5
未找到文件。
app/models/issue.rb
浏览文件 @
0385cd5a
...
@@ -106,7 +106,7 @@ class Issue < ActiveRecord::Base
...
@@ -106,7 +106,7 @@ class Issue < ActiveRecord::Base
def
related_branches
def
related_branches
project
.
repository
.
branch_names
.
select
do
|
branch
|
project
.
repository
.
branch_names
.
select
do
|
branch
|
branch
.
end_with?
(
"-
#{
iid
}
"
)
branch
=~
/\A
#{
iid
}
-(?!\d+-stable)/i
end
end
end
end
...
@@ -151,7 +151,7 @@ class Issue < ActiveRecord::Base
...
@@ -151,7 +151,7 @@ class Issue < ActiveRecord::Base
end
end
def
to_branch_name
def
to_branch_name
"
#{
title
.
parameterize
}
-
#{
iid
}
"
"
#{
iid
}
-
#{
title
.
parameterize
}
"
end
end
def
can_be_worked_on?
(
current_user
)
def
can_be_worked_on?
(
current_user
)
...
...
app/services/merge_requests/build_service.rb
浏览文件 @
0385cd5a
...
@@ -51,7 +51,7 @@ module MergeRequests
...
@@ -51,7 +51,7 @@ module MergeRequests
# be interpreted as the use wants to close that issue on this project
# be interpreted as the use wants to close that issue on this project
# Pattern example: 112-fix-mep-mep
# Pattern example: 112-fix-mep-mep
# Will lead to appending `Closes #112` to the description
# Will lead to appending `Closes #112` to the description
if
match
=
merge_request
.
source_branch
.
match
(
/
-(\d+)\z
/
)
if
match
=
merge_request
.
source_branch
.
match
(
/
\A(\d+)-
/
)
iid
=
match
[
1
]
iid
=
match
[
1
]
closes_issue
=
"Closes #
#{
iid
}
"
closes_issue
=
"Closes #
#{
iid
}
"
...
...
app/services/system_note_service.rb
浏览文件 @
0385cd5a
...
@@ -222,7 +222,7 @@ class SystemNoteService
...
@@ -222,7 +222,7 @@ class SystemNoteService
# Called when a branch is created from the 'new branch' button on a issue
# Called when a branch is created from the 'new branch' button on a issue
# Example note text:
# Example note text:
#
#
# "Started branch `
issue-branch-button-201
`"
# "Started branch `
201-issue-branch-button
`"
def
self
.
new_issue_branch
(
issue
,
project
,
author
,
branch
)
def
self
.
new_issue_branch
(
issue
,
project
,
author
,
branch
)
h
=
Gitlab
::
Routing
.
url_helpers
h
=
Gitlab
::
Routing
.
url_helpers
link
=
h
.
namespace_project_compare_url
(
project
.
namespace
,
project
,
from:
project
.
default_branch
,
to:
branch
)
link
=
h
.
namespace_project_compare_url
(
project
.
namespace
,
project
,
from:
project
.
default_branch
,
to:
branch
)
...
...
doc/workflow/web_editor.md
浏览文件 @
0385cd5a
...
@@ -85,7 +85,7 @@ Once you click it, a new branch will be created that diverges from the default
...
@@ -85,7 +85,7 @@ Once you click it, a new branch will be created that diverges from the default
branch of your project, by default
`master`
. The branch name will be based on
branch of your project, by default
`master`
. The branch name will be based on
the title of the issue and as suffix it will have its ID. Thus, the example
the title of the issue and as suffix it will have its ID. Thus, the example
screenshot above will yield a branch named
screenshot above will yield a branch named
`
et-cum-et-sed-expedita-repellat-consequatur-ut-assumenda-numquam-rerum-2
`
.
`
2-et-cum-et-sed-expedita-repellat-consequatur-ut-assumenda-numquam-rerum
`
.
After the branch is created, you can edit files in the repository to fix
After the branch is created, you can edit files in the repository to fix
the issue. When a merge request is created based on the newly created branch,
the issue. When a merge request is created based on the newly created branch,
...
...
spec/models/issue_spec.rb
浏览文件 @
0385cd5a
...
@@ -191,12 +191,19 @@ describe Issue, models: true do
...
@@ -191,12 +191,19 @@ describe Issue, models: true do
end
end
describe
'#related_branches'
do
describe
'#related_branches'
do
it
"selects the right branches"
do
it
'selects the right branches'
do
allow
(
subject
.
project
.
repository
).
to
receive
(
:branch_names
).
allow
(
subject
.
project
.
repository
).
to
receive
(
:branch_names
).
and_return
([
"mpempe"
,
"
#{
subject
.
iid
}
mepmep"
,
subject
.
to_branch_name
])
and_return
([
'mpempe'
,
"
#{
subject
.
iid
}
mepmep"
,
subject
.
to_branch_name
])
expect
(
subject
.
related_branches
).
to
eq
([
subject
.
to_branch_name
])
expect
(
subject
.
related_branches
).
to
eq
([
subject
.
to_branch_name
])
end
end
it
'excludes stable branches from the related branches'
do
allow
(
subject
.
project
.
repository
).
to
receive
(
:branch_names
).
and_return
([
"
#{
subject
.
iid
}
-0-stable"
])
expect
(
subject
.
related_branches
).
to
eq
[]
end
end
end
it_behaves_like
'an editable mentionable'
do
it_behaves_like
'an editable mentionable'
do
...
@@ -210,11 +217,11 @@ describe Issue, models: true do
...
@@ -210,11 +217,11 @@ describe Issue, models: true do
let
(
:subject
)
{
create
:issue
}
let
(
:subject
)
{
create
:issue
}
end
end
describe
"#to_branch_name"
do
describe
'#to_branch_name'
do
let
(
:issue
)
{
create
(
:issue
,
title:
'a'
*
30
)
}
let
(
:issue
)
{
create
(
:issue
,
title:
'a'
*
30
)
}
it
"starts with the issue iid"
do
it
'starts with the issue iid'
do
expect
(
issue
.
to_branch_name
).
to
match
/
-
#{
issue
.
iid
}
\z/
expect
(
issue
.
to_branch_name
).
to
match
/
\A
#{
issue
.
iid
}
-a+
\z/
end
end
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录