BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
18b8f5cb
Commit
18b8f5cb
authored
Feb 13, 2017
by
Sean McGivern
Committed by
Felipe Artur
Feb 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch '27886_rebasing_fix' into 'master'
Mark as WIP based on MR commits only Closes #27886 See merge request !9085
parent
97ea49c6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
10 deletions
+37
-10
refresh_service.rb
app/services/merge_requests/refresh_service.rb
+5
-1
refresh_service_spec.rb
spec/services/merge_requests/refresh_service_spec.rb
+32
-9
No files found.
app/services/merge_requests/refresh_service.rb
View file @
18b8f5cb
...
...
@@ -144,7 +144,11 @@ module MergeRequests
return
unless
@commits
.
present?
merge_requests_for_source_branch
.
each
do
|
merge_request
|
wip_commit
=
@commits
.
detect
(
&
:work_in_progress?
)
commit_shas
=
merge_request
.
commits_sha
wip_commit
=
@commits
.
detect
do
|
commit
|
commit
.
work_in_progress?
&&
commit_shas
.
include?
(
commit
.
sha
)
end
if
wip_commit
&&
!
merge_request
.
work_in_progress?
merge_request
.
update
(
title:
merge_request
.
wip_title
)
...
...
spec/services/merge_requests/refresh_service_spec.rb
View file @
18b8f5cb
...
...
@@ -287,41 +287,64 @@ describe MergeRequests::RefreshService, services: true do
it
'references the commit that caused the Work in Progress status'
do
refresh_service
.
execute
(
@oldrev
,
@newrev
,
'refs/heads/master'
)
allow
(
refresh_service
).
to
receive
(
:find_new_commits
)
refresh_service
.
instance_variable_set
(
"@commits"
,
[
instance_double
(
Commit
,
double
(
id:
'aaaaaaa'
,
sha:
'38008cb17ce1466d8fec2dfa6f6ab8dcfe5cf49e'
,
short_id:
'aaaaaaa'
,
title:
'Fix issue'
,
work_in_progress?:
false
),
instance_double
(
Commit
,
double
(
id:
'bbbbbbb'
,
sha:
'498214de67004b1da3d820901307bed2a68a8ef6'
,
short_id:
'bbbbbbb'
,
title:
'fixup! Fix issue'
,
work_in_progress?:
true
,
to_reference:
'bbbbbbb'
),
instance_double
(
Commit
,
double
(
id:
'ccccccc'
,
sha:
'1b12f15a11fc6e62177bef08f47bc7b5ce50b141'
,
short_id:
'ccccccc'
,
title:
'fixup! Fix issue'
,
work_in_progress?:
true
,
to_reference:
'ccccccc'
),
])
refresh_service
.
execute
(
@oldrev
,
@newrev
,
'refs/heads/wip'
)
reload_mrs
expect
(
@merge_request
.
notes
.
last
.
note
).
to
eq
(
"marked as a **Work In Progress** from bbbbbbb"
)
end
it
'does not mark as WIP based on commits that do not belong to an MR'
do
allow
(
refresh_service
).
to
receive
(
:find_new_commits
)
refresh_service
.
instance_variable_set
(
"@commits"
,
[
double
(
id:
'aaaaaaa'
,
sha:
'aaaaaaa'
,
short_id:
'aaaaaaa'
,
title:
'Fix issue'
,
work_in_progress?:
false
),
double
(
id:
'bbbbbbb'
,
sha:
'bbbbbbbb'
,
short_id:
'bbbbbbb'
,
title:
'fixup! Fix issue'
,
work_in_progress?:
true
,
to_reference:
'bbbbbbb'
)
])
refresh_service
.
execute
(
@oldrev
,
@newrev
,
'refs/heads/master'
)
reload_mrs
expect
(
@merge_request
.
work_in_progress?
).
to
be_falsey
end
end
def
reload_mrs
...
...
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