##// END OF EJS Templates
api: Add merge reference to merge_pull_request api call.
Martin Bornhold -
r1055:298b49a9 default
parent child Browse files
Show More
@@ -250,7 +250,12 b' def merge_pull_request(request, apiuser,'
250 250 "executed": "<bool>",
251 251 "failure_reason": "<int>",
252 252 "merge_commit_id": "<merge_commit_id>",
253 "possible": "<bool>"
253 "possible": "<bool>",
254 "merge_ref": {
255 "commit_id": "<commit_id>",
256 "type": "<type>",
257 "name": "<name>"
258 }
254 259 },
255 260 "error": null
256 261
@@ -278,13 +283,21 b' def merge_pull_request(request, apiuser,'
278 283 request.environ, repo_name=target_repo.repo_name,
279 284 username=apiuser.username, action='push',
280 285 scm=target_repo.repo_type)
281 data = PullRequestModel().merge(pull_request, apiuser, extras=extras)
282 if data.executed:
286 merge_response = PullRequestModel().merge(
287 pull_request, apiuser, extras=extras)
288 if merge_response.executed:
283 289 PullRequestModel().close_pull_request(
284 290 pull_request.pull_request_id, apiuser)
285 291
286 292 Session().commit()
287 return data
293
294 # In previous versions the merge response directly contained the merge
295 # commit id. It is now contained in the merge reference object. To be
296 # backwards compatible we have to extract it again.
297 merge_response = merge_response._asdict()
298 merge_response['merge_commit_id'] = merge_response['merge_ref'].commit_id
299
300 return merge_response
288 301
289 302
290 303 @jsonrpc_method()
General Comments 0
You need to be logged in to leave comments. Login now