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
d5102cf7
Commit
d5102cf7
authored
Apr 03, 2017
by
Jarka Kadlecova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Search for opened MRs - include reopened MRs
parent
e7e93072
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
1 deletion
+32
-1
app/services/merge_requests/base_service.rb
app/services/merge_requests/base_service.rb
+1
-1
changelogs/unreleased/30291-reopen-mr.yml
changelogs/unreleased/30291-reopen-mr.yml
+4
-0
spec/services/merge_requests/refresh_service_spec.rb
spec/services/merge_requests/refresh_service_spec.rb
+27
-0
No files found.
app/services/merge_requests/base_service.rb
View file @
d5102cf7
...
...
@@ -39,7 +39,7 @@ module MergeRequests
private
# Returns all origin and fork merge requests from `@project` satisfying passed arguments.
def
merge_requests_for
(
source_branch
,
mr_states:
[
:opened
])
def
merge_requests_for
(
source_branch
,
mr_states:
[
:opened
,
:reopened
])
MergeRequest
.
with_state
(
mr_states
)
.
where
(
source_branch:
source_branch
,
source_project_id:
@project
.
id
)
...
...
changelogs/unreleased/30291-reopen-mr.yml
0 → 100644
View file @
d5102cf7
---
title
:
Include reopened MRs when searching for opened ones
merge_request
:
10407
author
:
spec/services/merge_requests/refresh_service_spec.rb
View file @
d5102cf7
...
...
@@ -49,6 +49,7 @@ describe MergeRequests::RefreshService, services: true do
context
'push to origin repo source branch'
do
let
(
:refresh_service
)
{
service
.
new
(
@project
,
@user
)
}
before
do
allow
(
refresh_service
).
to
receive
(
:execute_hooks
)
refresh_service
.
execute
(
@oldrev
,
@newrev
,
'refs/heads/master'
)
...
...
@@ -70,6 +71,32 @@ describe MergeRequests::RefreshService, services: true do
end
end
context
'push to origin repo source branch when an MR was reopened'
do
let
(
:refresh_service
)
{
service
.
new
(
@project
,
@user
)
}
before
do
@merge_request
.
update
(
state: :reopened
)
allow
(
refresh_service
).
to
receive
(
:execute_hooks
)
refresh_service
.
execute
(
@oldrev
,
@newrev
,
'refs/heads/master'
)
reload_mrs
end
it
'executes hooks with update action'
do
expect
(
refresh_service
).
to
have_received
(
:execute_hooks
).
with
(
@merge_request
,
'update'
,
@oldrev
)
expect
(
@merge_request
.
notes
).
not_to
be_empty
expect
(
@merge_request
).
to
be_open
expect
(
@merge_request
.
merge_when_pipeline_succeeds
).
to
be_falsey
expect
(
@merge_request
.
diff_head_sha
).
to
eq
(
@newrev
)
expect
(
@fork_merge_request
).
to
be_open
expect
(
@fork_merge_request
.
notes
).
to
be_empty
expect
(
@build_failed_todo
).
to
be_done
expect
(
@fork_build_failed_todo
).
to
be_done
end
end
context
'push to origin repo target branch'
do
before
do
service
.
new
(
@project
,
@user
).
execute
(
@oldrev
,
@newrev
,
'refs/heads/feature'
)
...
...
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