From 69359066eb667aa0623621ec7df29f03f77e40af Mon Sep 17 00:00:00 2001 From: jubianchi Date: Sun, 25 May 2014 01:44:01 +0200 Subject: [PATCH] Add merge method to MR API --- lib/Gitlab/Api/MergeRequests.php | 5 +++++ lib/Gitlab/Model/MergeRequest.php | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/lib/Gitlab/Api/MergeRequests.php b/lib/Gitlab/Api/MergeRequests.php index cdbc546fe..401a7ba52 100644 --- a/lib/Gitlab/Api/MergeRequests.php +++ b/lib/Gitlab/Api/MergeRequests.php @@ -37,6 +37,11 @@ public function update($project_id, $mr_id, array $params) return $this->put('projects/'.urlencode($project_id).'/merge_request/'.urlencode($mr_id), $params); } + public function merge($project_id, $mr_id, array $params) + { + return $this->put('projects/'.urlencode($project_id).'/merge_request/'.urlencode($mr_id).'/merge', $params); + } + public function addComment($project_id, $mr_id, $note) { return $this->post('projects/'.urlencode($project_id).'/merge_request/'.urlencode($mr_id).'/comments', array( diff --git a/lib/Gitlab/Model/MergeRequest.php b/lib/Gitlab/Model/MergeRequest.php index 52592b487..90755de46 100644 --- a/lib/Gitlab/Model/MergeRequest.php +++ b/lib/Gitlab/Model/MergeRequest.php @@ -80,6 +80,13 @@ public function reopen() )); } + public function merge($message = null) + { + $data = $this->api('mr')->merge($this->project->id, $this->id, array('merge_commit_message' => $message)); + + return MergeRequest::fromArray($this->getClient(), $this->project, $data); + } + public function merged() { return $this->update(array(