Skip to content

Commit 6935906

Browse files
committed
Add merge method to MR API
1 parent 5eabc6b commit 6935906

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/Gitlab/Api/MergeRequests.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ public function update($project_id, $mr_id, array $params)
3737
return $this->put('projects/'.urlencode($project_id).'/merge_request/'.urlencode($mr_id), $params);
3838
}
3939

40+
public function merge($project_id, $mr_id, array $params)
41+
{
42+
return $this->put('projects/'.urlencode($project_id).'/merge_request/'.urlencode($mr_id).'/merge', $params);
43+
}
44+
4045
public function addComment($project_id, $mr_id, $note)
4146
{
4247
return $this->post('projects/'.urlencode($project_id).'/merge_request/'.urlencode($mr_id).'/comments', array(

lib/Gitlab/Model/MergeRequest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ public function reopen()
8080
));
8181
}
8282

83+
public function merge($message = null)
84+
{
85+
$data = $this->api('mr')->merge($this->project->id, $this->id, array('merge_commit_message' => $message));
86+
87+
return MergeRequest::fromArray($this->getClient(), $this->project, $data);
88+
}
89+
8390
public function merged()
8491
{
8592
return $this->update(array(

0 commit comments

Comments
 (0)