Commit 5880d7df6253fc97024005e7c32dbc41def99aaf
1 parent
0c73e666
Exists in
spb-stable
and in
2 other branches
Docs for merge api
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
2 changed files
with
49 additions
and
0 deletions
Show diff stats
doc/api/merge_requests.md
... | ... | @@ -189,6 +189,54 @@ Parameters: |
189 | 189 | ``` |
190 | 190 | |
191 | 191 | |
192 | +## Accept MR | |
193 | + | |
194 | +Merge changes submitted with MR usign this API. | |
195 | +If merge success you get 200 OK. | |
196 | +If it has some conflicts and can not be merged - you get 405 and error message 'Branch cannot be merged' | |
197 | +If merge request is already merged or closed - you get 405 and error message 'Method Not Allowed' | |
198 | +If you dont have permissions to accept this merge request - you get 401 | |
199 | + | |
200 | +``` | |
201 | +PUT /projects/:id/merge_request/:merge_request_id/merge | |
202 | +``` | |
203 | + | |
204 | +Parameters: | |
205 | + | |
206 | ++ `id` (required) - The ID of a project | |
207 | ++ `merge_request_id` (required) - ID of MR | |
208 | ++ `merge_commit_message` (optional) - Custom merge commit message | |
209 | + | |
210 | +```json | |
211 | +{ | |
212 | + "id": 1, | |
213 | + "target_branch": "master", | |
214 | + "source_branch": "test1", | |
215 | + "project_id": 3, | |
216 | + "title": "test1", | |
217 | + "state": "merged", | |
218 | + "upvotes": 0, | |
219 | + "downvotes": 0, | |
220 | + "author": { | |
221 | + "id": 1, | |
222 | + "username": "admin", | |
223 | + "email": "admin@local.host", | |
224 | + "name": "Administrator", | |
225 | + "state": "active", | |
226 | + "created_at": "2012-04-29T08:46:00Z" | |
227 | + }, | |
228 | + "assignee": { | |
229 | + "id": 1, | |
230 | + "username": "admin", | |
231 | + "email": "admin@local.host", | |
232 | + "name": "Administrator", | |
233 | + "state": "active", | |
234 | + "created_at": "2012-04-29T08:46:00Z" | |
235 | + } | |
236 | +} | |
237 | +``` | |
238 | + | |
239 | + | |
192 | 240 | ## Post comment to MR |
193 | 241 | |
194 | 242 | Adds a comment to a merge request. | ... | ... |
lib/api/merge_requests.rb
... | ... | @@ -137,6 +137,7 @@ module API |
137 | 137 | if merge_request.open? |
138 | 138 | if merge_request.can_be_merged? |
139 | 139 | merge_request.automerge!(current_user, params[:merge_commit_message] || merge_request.merge_commit_message) |
140 | + present merge_request, with: Entities::MergeRequest | |
140 | 141 | else |
141 | 142 | render_api_error!('Branch cannot be merged', 405) |
142 | 143 | end | ... | ... |