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
0385cd5a
Commit
0385cd5a
authored
Apr 13, 2016
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start with iid on branch creation
parent
c0678f2d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
10 deletions
+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
No files found.
app/models/issue.rb
View file @
0385cd5a
...
...
@@ -106,7 +106,7 @@ class Issue < ActiveRecord::Base
def
related_branches
project
.
repository
.
branch_names
.
select
do
|
branch
|
branch
.
end_with?
(
"-
#{
iid
}
"
)
branch
=~
/\A
#{
iid
}
-(?!\d+-stable)/i
end
end
...
...
@@ -151,7 +151,7 @@ class Issue < ActiveRecord::Base
end
def
to_branch_name
"
#{
title
.
parameterize
}
-
#{
iid
}
"
"
#{
iid
}
-
#{
title
.
parameterize
}
"
end
def
can_be_worked_on?
(
current_user
)
...
...
app/services/merge_requests/build_service.rb
View file @
0385cd5a
...
...
@@ -51,7 +51,7 @@ module MergeRequests
# be interpreted as the use wants to close that issue on this project
# Pattern example: 112-fix-mep-mep
# 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
]
closes_issue
=
"Closes #
#{
iid
}
"
...
...
app/services/system_note_service.rb
View file @
0385cd5a
...
...
@@ -222,7 +222,7 @@ class SystemNoteService
# Called when a branch is created from the 'new branch' button on a issue
# Example note text:
#
# "Started branch `
issue-branch-button-201
`"
# "Started branch `
201-issue-branch-button
`"
def
self
.
new_issue_branch
(
issue
,
project
,
author
,
branch
)
h
=
Gitlab
::
Routing
.
url_helpers
link
=
h
.
namespace_project_compare_url
(
project
.
namespace
,
project
,
from:
project
.
default_branch
,
to:
branch
)
...
...
doc/workflow/web_editor.md
View file @
0385cd5a
...
...
@@ -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
the title of the issue and as suffix it will have its ID. Thus, the example
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
the issue. When a merge request is created based on the newly created branch,
...
...
spec/models/issue_spec.rb
View file @
0385cd5a
...
...
@@ -191,12 +191,19 @@ describe Issue, models: true do
end
describe
'#related_branches'
do
it
"selects the right branches"
do
it
'selects the right branches'
do
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
])
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
it_behaves_like
'an editable mentionable'
do
...
...
@@ -210,11 +217,11 @@ describe Issue, models: true do
let
(
:subject
)
{
create
:issue
}
end
describe
"#to_branch_name"
do
describe
'#to_branch_name'
do
let
(
:issue
)
{
create
(
:issue
,
title:
'a'
*
30
)
}
it
"starts with the issue iid"
do
expect
(
issue
.
to_branch_name
).
to
match
/
-
#{
issue
.
iid
}
\z/
it
'starts with the issue iid'
do
expect
(
issue
.
to_branch_name
).
to
match
/
\A
#{
issue
.
iid
}
-a+
\z/
end
end
end
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