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
Boxiang Sun
gitlab-ce
Commits
36c094b0
Commit
36c094b0
authored
Mar 16, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gmessner/gitlab-ce-issue-110'
parents
f3220aba
fddbd7b2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
CHANGELOG
CHANGELOG
+1
-0
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+4
-2
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+8
-1
No files found.
CHANGELOG
View file @
36c094b0
...
@@ -22,6 +22,7 @@ v 6.7.0
...
@@ -22,6 +22,7 @@ v 6.7.0
- Changed markdown new line behaviour to conform to markdown standards
- Changed markdown new line behaviour to conform to markdown standards
- Fix global search
- Fix global search
- Faster authorized_keys rebuilding in `rake gitlab:shell:setup` (requires gitlab-shell 1.8.5)
- Faster authorized_keys rebuilding in `rake gitlab:shell:setup` (requires gitlab-shell 1.8.5)
- Create and Update MR calls now support the description parameter (Greg Messner)
v 6.6.2
v 6.6.2
- Fix 500 error on branch/tag create or remove via UI
- Fix 500 error on branch/tag create or remove via UI
...
...
lib/api/merge_requests.rb
View file @
36c094b0
...
@@ -64,6 +64,7 @@ module API
...
@@ -64,6 +64,7 @@ module API
# target_project - The target project of the merge request defaults to the :id of the project
# target_project - The target project of the merge request defaults to the :id of the project
# assignee_id - Assignee user ID
# assignee_id - Assignee user ID
# title (required) - Title of MR
# title (required) - Title of MR
# description - Description of MR
#
#
# Example:
# Example:
# POST /projects/:id/merge_requests
# POST /projects/:id/merge_requests
...
@@ -72,7 +73,7 @@ module API
...
@@ -72,7 +73,7 @@ module API
set_current_user_for_thread
do
set_current_user_for_thread
do
authorize!
:write_merge_request
,
user_project
authorize!
:write_merge_request
,
user_project
required_attributes!
[
:source_branch
,
:target_branch
,
:title
]
required_attributes!
[
:source_branch
,
:target_branch
,
:title
]
attrs
=
attributes_for_keys
[
:source_branch
,
:target_branch
,
:assignee_id
,
:title
,
:target_project_id
]
attrs
=
attributes_for_keys
[
:source_branch
,
:target_branch
,
:assignee_id
,
:title
,
:target_project_id
,
:description
]
merge_request
=
user_project
.
merge_requests
.
new
(
attrs
)
merge_request
=
user_project
.
merge_requests
.
new
(
attrs
)
merge_request
.
author
=
current_user
merge_request
.
author
=
current_user
merge_request
.
source_project
=
user_project
merge_request
.
source_project
=
user_project
...
@@ -105,12 +106,13 @@ module API
...
@@ -105,12 +106,13 @@ module API
# assignee_id - Assignee user ID
# assignee_id - Assignee user ID
# title - Title of MR
# title - Title of MR
# state_event - Status of MR. (close|reopen|merge)
# state_event - Status of MR. (close|reopen|merge)
# description - Description of MR
# Example:
# Example:
# PUT /projects/:id/merge_request/:merge_request_id
# PUT /projects/:id/merge_request/:merge_request_id
#
#
put
":id/merge_request/:merge_request_id"
do
put
":id/merge_request/:merge_request_id"
do
set_current_user_for_thread
do
set_current_user_for_thread
do
attrs
=
attributes_for_keys
[
:source_branch
,
:target_branch
,
:assignee_id
,
:title
,
:state_event
]
attrs
=
attributes_for_keys
[
:source_branch
,
:target_branch
,
:assignee_id
,
:title
,
:state_event
,
:description
]
merge_request
=
user_project
.
merge_requests
.
find
(
params
[
:merge_request_id
])
merge_request
=
user_project
.
merge_requests
.
find
(
params
[
:merge_request_id
])
authorize!
:modify_merge_request
,
merge_request
authorize!
:modify_merge_request
,
merge_request
...
...
spec/requests/api/merge_requests_spec.rb
View file @
36c094b0
...
@@ -92,9 +92,10 @@ describe API::API do
...
@@ -92,9 +92,10 @@ describe API::API do
it
"should return merge_request"
do
it
"should return merge_request"
do
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
title:
'Test merge_request'
,
source_branch:
"stable"
,
target_branch:
"master"
,
author:
user2
,
target_project_id:
project
.
id
title:
'Test merge_request'
,
source_branch:
"stable"
,
target_branch:
"master"
,
author:
user2
,
target_project_id:
project
.
id
,
description:
'Test description for Test merge_request'
response
.
status
.
should
==
201
response
.
status
.
should
==
201
json_response
[
'title'
].
should
==
'Test merge_request'
json_response
[
'title'
].
should
==
'Test merge_request'
json_response
[
'description'
].
should
==
'Test description for Test merge_request'
end
end
it
"should not return 422 when source_branch equals target_branch"
do
it
"should not return 422 when source_branch equals target_branch"
do
...
@@ -168,6 +169,12 @@ describe API::API do
...
@@ -168,6 +169,12 @@ describe API::API do
json_response
[
'title'
].
should
==
'New title'
json_response
[
'title'
].
should
==
'New title'
end
end
it
"should return merge_request"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_request/
#{
merge_request
.
id
}
"
,
user
),
description:
"New description"
response
.
status
.
should
==
200
json_response
[
'description'
].
should
==
'New description'
end
it
"should return 422 when source_branch and target_branch are renamed the same"
do
it
"should return 422 when source_branch and target_branch are renamed the same"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_request/
#{
merge_request
.
id
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/merge_request/
#{
merge_request
.
id
}
"
,
user
),
source_branch:
"master"
,
target_branch:
"master"
source_branch:
"master"
,
target_branch:
"master"
...
...
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