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
Léo-Paul Géneau
gitlab-ce
Commits
7e9484e9
Commit
7e9484e9
authored
Jan 12, 2018
by
Jarka Kadlecová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set target_branch to the ref branch when creating MR from issue
parent
2de8fb7b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
app/services/merge_requests/create_from_issue_service.rb
app/services/merge_requests/create_from_issue_service.rb
+1
-0
changelogs/unreleased/41727-target-branch-name.yml
changelogs/unreleased/41727-target-branch-name.yml
+5
-0
spec/services/merge_requests/create_from_issue_service_spec.rb
...services/merge_requests/create_from_issue_service_spec.rb
+19
-0
No files found.
app/services/merge_requests/create_from_issue_service.rb
View file @
7e9484e9
...
@@ -54,6 +54,7 @@ module MergeRequests
...
@@ -54,6 +54,7 @@ module MergeRequests
source_project_id:
project
.
id
,
source_project_id:
project
.
id
,
source_branch:
branch_name
,
source_branch:
branch_name
,
target_project_id:
project
.
id
,
target_project_id:
project
.
id
,
target_branch:
ref
,
milestone_id:
issue
.
milestone_id
milestone_id:
issue
.
milestone_id
}
}
end
end
...
...
changelogs/unreleased/41727-target-branch-name.yml
0 → 100644
View file @
7e9484e9
---
title
:
Set target_branch to the ref branch when creating MR from issue
merge_request
:
author
:
type
:
fixed
spec/services/merge_requests/create_from_issue_service_spec.rb
View file @
7e9484e9
...
@@ -112,5 +112,24 @@ describe MergeRequests::CreateFromIssueService do
...
@@ -112,5 +112,24 @@ describe MergeRequests::CreateFromIssueService do
expect
(
result
[
:merge_request
].
assignee
).
to
eq
(
user
)
expect
(
result
[
:merge_request
].
assignee
).
to
eq
(
user
)
end
end
context
'when ref branch is set'
do
subject
{
described_class
.
new
(
project
,
user
,
issue_iid:
issue
.
iid
,
ref:
'feature'
).
execute
}
it
'sets the merge request source branch to the new issue branch'
do
expect
(
subject
[
:merge_request
].
source_branch
).
to
eq
(
issue
.
to_branch_name
)
end
it
'sets the merge request target branch to the ref branch'
do
expect
(
subject
[
:merge_request
].
target_branch
).
to
eq
(
'feature'
)
end
context
'when ref branch does not exist'
do
it
'does not create a merge request'
do
expect
{
described_class
.
new
(
project
,
user
,
issue_iid:
issue
.
iid
,
ref:
'nobr'
).
execute
}
.
not_to
change
{
project
.
merge_requests
.
count
}
end
end
end
end
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