From f773bbd752f5847565527c8b1abced03e60635ea Mon Sep 17 00:00:00 2001 From: jubianchi Date: Sun, 25 May 2014 12:19:10 +0200 Subject: [PATCH] Handle MR description --- lib/Gitlab/Api/MergeRequests.php | 7 ++++--- lib/Gitlab/Model/Project.php | 14 +++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/Gitlab/Api/MergeRequests.php b/lib/Gitlab/Api/MergeRequests.php index cdbc546fe..096436e2c 100644 --- a/lib/Gitlab/Api/MergeRequests.php +++ b/lib/Gitlab/Api/MergeRequests.php @@ -17,10 +17,10 @@ public function show($project_id, $mr_id) return $this->get('projects/'.urlencode($project_id).'/merge_request/'.urlencode($mr_id)); } - public function create($project_id, $source, $target, $title, $assignee = null, $target_project_id = null) + public function create($project_id, $source, $target, $title, $assignee = null, $target_project_id = null, $description = null) { if ($target_project_id && ! is_numeric($target_project_id)) { - throw new InvalidArgumentException('target_project_id should be numeric, the project name is not allowed'); + throw new \InvalidArgumentException('target_project_id should be numeric, the project name is not allowed'); } return $this->post('projects/'.urlencode($project_id).'/merge_requests', array( @@ -28,7 +28,8 @@ public function create($project_id, $source, $target, $title, $assignee = null, 'target_branch' => $target, 'title' => $title, 'assignee_id' => $assignee, - 'target_project_id' => $target_project_id + 'target_project_id' => $target_project_id, + 'description' => $description )); } diff --git a/lib/Gitlab/Model/Project.php b/lib/Gitlab/Model/Project.php index db517aaf3..1091519a9 100644 --- a/lib/Gitlab/Model/Project.php +++ b/lib/Gitlab/Model/Project.php @@ -330,9 +330,9 @@ public function mergeRequest($id) return $mr->show(); } - public function createMergeRequest($source, $target, $title, $assignee = null) + public function createMergeRequest($source, $target, $title, $assignee = null, $description = null) { - $data = $this->api('mr')->create($this->id, $source, $target, $title, $assignee); + $data = $this->api('mr')->create($this->id, $source, $target, $title, $assignee, null, $description); return MergeRequest::fromArray($this->getClient(), $this, $data); } @@ -494,12 +494,12 @@ public function removeSnippet($id) return $snippet->remove(); } - public function transfer($group_id) - { - $group = new Group($group_id, $this->getClient()); + public function transfer($group_id) + { + $group = new Group($group_id, $this->getClient()); - return $group->transfer($this->id); - } + return $group->transfer($this->id); + } public function forkTo($id) {