Skip to content

Commit

Permalink
Merge pull request #249 from zapelin/master
Browse files Browse the repository at this point in the history
Added getHtmlUrl() to GHCommit
  • Loading branch information
kohsuke committed Mar 1, 2016
2 parents dbcc9af + f4b129b commit 94af819
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/java/org/kohsuke/github/GHCommit.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static class User {
String login;
}

String url,sha;
String url,html_url,sha;
List<File> files;
Stats stats;
List<Parent> parents;
Expand Down Expand Up @@ -214,6 +214,13 @@ public int getLinesDeleted() throws IOException {
return stats.deletions;
}

/**
* URL of this commit like "https://github.com/kohsuke/sandbox-ant/commit/8ae38db0ea5837313ab5f39d43a6f73de3bd9000"
*/
public URL getHtmlUrl() {
return GitHub.parseURL(html_url);
}

/**
* [0-9a-f]{40} SHA1 checksum.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/org/kohsuke/github/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ public void testCommit() throws Exception {
System.out.println(commit);
assertEquals(1, commit.getParents().size());
assertEquals(1,commit.getFiles().size());
assertEquals("https://github.com/jenkinsci/jenkins/commit/08c1c9970af4d609ae754fbe803e06186e3206f7",
commit.getHtmlUrl().toString());

File f = commit.getFiles().get(0);
assertEquals(48,f.getLinesChanged());
Expand Down

0 comments on commit 94af819

Please sign in to comment.