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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
ea7bf7ed
Commit
ea7bf7ed
authored
Dec 22, 2016
by
jurre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show a custom WIP help message for MR's with WIP commits
parent
e59623e7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
2 deletions
+70
-2
app/views/projects/merge_requests/_new_submit.html.haml
app/views/projects/merge_requests/_new_submit.html.haml
+1
-1
app/views/shared/issuable/_form.html.haml
app/views/shared/issuable/_form.html.haml
+2
-1
app/views/shared/issuable/form/_title.html.haml
app/views/shared/issuable/form/_title.html.haml
+4
-0
spec/features/merge_requests/wip_message_spec.rb
spec/features/merge_requests/wip_message_spec.rb
+63
-0
No files found.
app/views/projects/merge_requests/_new_submit.html.haml
View file @
ea7bf7ed
...
...
@@ -11,7 +11,7 @@
=
link_to
'Change branches'
,
mr_change_branches_path
(
@merge_request
)
%hr
=
form_for
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@merge_request
],
html:
{
class:
'merge-request-form form-horizontal common-note-form js-requires-input js-quick-submit'
}
do
|
f
|
=
render
'shared/issuable/form'
,
f:
f
,
issuable:
@merge_request
=
render
'shared/issuable/form'
,
f:
f
,
issuable:
@merge_request
,
commits:
@commits
=
f
.
hidden_field
:source_project_id
=
f
.
hidden_field
:source_branch
=
f
.
hidden_field
:target_project_id
...
...
app/views/shared/issuable/_form.html.haml
View file @
ea7bf7ed
-
form
=
local_assigns
.
fetch
(
:f
)
-
commits
=
local_assigns
[
:commits
]
-
project
=
@target_project
||
@project
=
form_errors
(
issuable
)
...
...
@@ -14,7 +15,7 @@
=
form
.
label
:title
,
class:
'control-label'
=
render
'shared/issuable/form/template_selector'
,
issuable:
issuable
=
render
'shared/issuable/form/title'
,
issuable:
issuable
,
form:
form
=
render
'shared/issuable/form/title'
,
issuable:
issuable
,
form:
form
,
has_wip_commits:
commits
&&
commits
.
detect
(
&
:work_in_progress?
)
=
render
'shared/issuable/form/description'
,
issuable:
issuable
,
form:
form
...
...
app/views/shared/issuable/form/_title.html.haml
View file @
ea7bf7ed
-
issuable
=
local_assigns
.
fetch
(
:issuable
)
-
has_wip_commits
=
local_assigns
.
fetch
(
:has_wip_commits
)
-
form
=
local_assigns
.
fetch
(
:form
)
-
no_issuable_templates
=
issuable_templates
(
issuable
).
empty?
-
div_class
=
no_issuable_templates
?
'col-sm-10'
:
'col-sm-7 col-lg-8'
...
...
@@ -18,6 +19,9 @@
%strong
Work In Progress
merge request to be merged when it's ready.
.js-no-wip-explanation
-
if
has_wip_commits
It looks like you have some WIP commits in this branch.
%br
%a
.js-toggle-wip
{
href:
''
,
tabindex:
-
1
}
Start the title with
%code
WIP:
...
...
spec/features/merge_requests/wip_message_spec.rb
0 → 100644
View file @
ea7bf7ed
require
'spec_helper'
feature
'Work In Progress help message'
,
feature:
true
do
let!
(
:project
)
{
create
(
:project
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
}
let!
(
:user
)
{
create
(
:user
)
}
before
do
project
.
team
<<
[
user
,
:master
]
login_as
(
user
)
end
context
'with WIP commits'
do
it
'shows a specific WIP hint'
do
visit
new_namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request:
{
source_project_id:
project
.
id
,
target_project_id:
project
.
id
,
source_branch:
'wip'
,
target_branch:
'master'
}
)
within_wip_explanation
do
expect
(
page
).
to
have_text
(
'It looks like you have some WIP commits in this branch'
)
end
end
end
context
'without WIP commits'
do
it
'shows the regular WIP message'
do
visit
new_namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request:
{
source_project_id:
project
.
id
,
target_project_id:
project
.
id
,
source_branch:
'fix'
,
target_branch:
'master'
}
)
within_wip_explanation
do
expect
(
page
).
not_to
have_text
(
'It looks like you have some WIP commits in this branch'
)
expect
(
page
).
to
have_text
(
"Start the title with WIP: to prevent a Work In Progress merge \
request from being merged before it's ready"
)
end
end
end
def
within_wip_explanation
(
&
block
)
page
.
within
'.js-no-wip-explanation'
do
yield
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