diff options
-rw-r--r-- | doc/api/merge_requests.md | 48 | ||||
-rw-r--r-- | lib/api/merge_requests.rb | 1 |
2 files changed, 49 insertions, 0 deletions
diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index d5b106729c9..d68f34971f1 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -189,6 +189,54 @@ Parameters: ``` +## Accept MR + +Merge changes submitted with MR usign this API. +If merge success you get 200 OK. +If it has some conflicts and can not be merged - you get 405 and error message 'Branch cannot be merged' +If merge request is already merged or closed - you get 405 and error message 'Method Not Allowed' +If you dont have permissions to accept this merge request - you get 401 + +``` +PUT /projects/:id/merge_request/:merge_request_id/merge +``` + +Parameters: + ++ `id` (required) - The ID of a project ++ `merge_request_id` (required) - ID of MR ++ `merge_commit_message` (optional) - Custom merge commit message + +```json +{ + "id": 1, + "target_branch": "master", + "source_branch": "test1", + "project_id": 3, + "title": "test1", + "state": "merged", + "upvotes": 0, + "downvotes": 0, + "author": { + "id": 1, + "username": "admin", + "email": "admin@local.host", + "name": "Administrator", + "state": "active", + "created_at": "2012-04-29T08:46:00Z" + }, + "assignee": { + "id": 1, + "username": "admin", + "email": "admin@local.host", + "name": "Administrator", + "state": "active", + "created_at": "2012-04-29T08:46:00Z" + } +} +``` + + ## Post comment to MR Adds a comment to a merge request. diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index f9a4037dd26..3dffe7bd4df 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -137,6 +137,7 @@ module API if merge_request.open? if merge_request.can_be_merged? merge_request.automerge!(current_user, params[:merge_commit_message] || merge_request.merge_commit_message) + present merge_request, with: Entities::MergeRequest else render_api_error!('Branch cannot be merged', 405) end |