Skip to content

Commit 3270322

Browse files
committed
Merge pull request #38 from jubianchi/mr-accept
Add merge method to MR API
2 parents 25f4361 + 6935906 commit 3270322

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
@@ -38,6 +38,11 @@ public function update($project_id, $mr_id, array $params)
3838
return $this->put('projects/'.urlencode($project_id).'/merge_request/'.urlencode($mr_id), $params);
3939
}
4040

41+
public function merge($project_id, $mr_id, array $params)
42+
{
43+
return $this->put('projects/'.urlencode($project_id).'/merge_request/'.urlencode($mr_id).'/merge', $params);
44+
}
45+
4146
public function addComment($project_id, $mr_id, $note)
4247
{
4348
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)