From 21a54e23332f98dcb30f379003bdbd2894172b5c Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Fri, 28 Mar 2014 09:40:55 -0700 Subject: [PATCH] The parent commit appears to be totally untested. The placement of the method makes no sense, and the API route is wrong. The parameter is missing, and the expected response type is wrong. --- src/main/java/org/kohsuke/github/GHPullRequest.java | 12 ++++++++++++ src/main/java/org/kohsuke/github/GHRepository.java | 11 ----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHPullRequest.java b/src/main/java/org/kohsuke/github/GHPullRequest.java index 0fa74962e..c01753988 100644 --- a/src/main/java/org/kohsuke/github/GHPullRequest.java +++ b/src/main/java/org/kohsuke/github/GHPullRequest.java @@ -205,4 +205,16 @@ public class GHPullRequest extends GHIssue { }; } + /** + * Merge this pull request. + * + * The equivalent of the big green "Merge pull request" button. + * + * @param msg + * Commit message. If null, the default one will be used. + */ + public void merge(String msg) throws IOException { + new Requester(root).method("PUT").with("commit_message",msg).to(getApiRoute()+"/merge"); + } + } diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index 43ea4e78a..c1146f8e4 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -822,15 +822,4 @@ public class GHRepository { String getApiTailUrl(String tail) { return "/repos/" + owner.login + "/" + name +'/'+tail; } - - /** - * Merge a pull request(Automating the Merge button). - * - * @return - * Merged repository that belong to you. - */ - public GHRepository mergePullRequest(int id) throws IOException { - - return new Requester(root).method("PUT").to("/repos/" + owner.login + "/" + name +"/"+ id+ "/merge", GHRepository.class).wrap(root); - } }