Compare commits

...

6 Commits

Author SHA1 Message Date
Kohsuke Kawaguchi
b0df93bbcb [maven-release-plugin] prepare release github-api-1.78 2016-10-24 14:10:30 -07:00
Kohsuke Kawaguchi
290d0b226a Merge pull request #295 from jglick/pageSize
Use maximum permitted page size
2016-10-24 14:04:05 -07:00
Kohsuke Kawaguchi
8b3469610c Merge pull request #300 from stephenc/commit-dates
Expose the commit dates
2016-10-24 14:03:14 -07:00
Stephen Connolly
50b47fb73b Expose the commit dates 2016-10-24 21:12:56 +01:00
Jesse Glick
38983df42d If we are a returning a collection of all things, we might as well use the maximum page size to minimize HTTP requests. 2016-09-19 09:48:23 -07:00
Kohsuke Kawaguchi
df963cb71c [maven-release-plugin] prepare for next development iteration 2016-08-05 21:32:15 -07:00
4 changed files with 33 additions and 5 deletions

View File

@@ -7,7 +7,7 @@
</parent> </parent>
<artifactId>github-api</artifactId> <artifactId>github-api</artifactId>
<version>1.77</version> <version>1.78</version>
<name>GitHub API for Java</name> <name>GitHub API for Java</name>
<url>http://github-api.kohsuke.org/</url> <url>http://github-api.kohsuke.org/</url>
<description>GitHub API for Java</description> <description>GitHub API for Java</description>
@@ -16,7 +16,7 @@
<connection>scm:git:git@github.com/kohsuke/${project.artifactId}.git</connection> <connection>scm:git:git@github.com/kohsuke/${project.artifactId}.git</connection>
<developerConnection>scm:git:ssh://git@github.com/kohsuke/${project.artifactId}.git</developerConnection> <developerConnection>scm:git:ssh://git@github.com/kohsuke/${project.artifactId}.git</developerConnection>
<url>http://${project.artifactId}.kohsuke.org/</url> <url>http://${project.artifactId}.kohsuke.org/</url>
<tag>github-api-1.77</tag> <tag>github-api-1.78</tag>
</scm> </scm>
<distributionManagement> <distributionManagement>

View File

@@ -2,12 +2,12 @@ package org.kohsuke.github;
import com.infradna.tool.bridge_method_injector.WithBridgeMethods; import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.AbstractList; import java.util.AbstractList;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@@ -42,11 +42,19 @@ public class GHCommit {
return author; return author;
} }
public Date getAuthoredDate() {
return GitHub.parseDate(author.date);
}
@WithBridgeMethods(value = GHAuthor.class, castRequired = true) @WithBridgeMethods(value = GHAuthor.class, castRequired = true)
public GitUser getCommitter() { public GitUser getCommitter() {
return committer; return committer;
} }
public Date getCommitDate() {
return GitHub.parseDate(author.date);
}
/** /**
* Commit message. * Commit message.
*/ */
@@ -63,6 +71,7 @@ public class GHCommit {
* @deprecated Use {@link GitUser} instead. * @deprecated Use {@link GitUser} instead.
*/ */
public static class GHAuthor extends GitUser { public static class GHAuthor extends GitUser {
private String date;
} }
public static class Stats { public static class Stats {
@@ -272,10 +281,29 @@ public class GHCommit {
return resolveUser(author); return resolveUser(author);
} }
/**
* Gets the date the change was authored on.
* @return the date the change was authored on.
* @throws IOException if the information was not already fetched and an attempt at fetching the information failed.
*/
public Date getAuthoredDate() throws IOException {
return getCommitShortInfo().getAuthoredDate();
}
public GHUser getCommitter() throws IOException { public GHUser getCommitter() throws IOException {
return resolveUser(committer); return resolveUser(committer);
} }
/**
* Gets the date the change was committed on.
*
* @return the date the change was committed on.
* @throws IOException if the information was not already fetched and an attempt at fetching the information failed.
*/
public Date getCommitDate() throws IOException {
return getCommitShortInfo().getCommitDate();
}
private GHUser resolveUser(User author) throws IOException { private GHUser resolveUser(User author) throws IOException {
if (author==null || author.login==null) return null; if (author==null || author.login==null) return null;
return owner.root.getUser(author.login); return owner.root.getUser(author.login);

View File

@@ -220,7 +220,7 @@ public class GHOrganization extends GHPerson {
*/ */
public List<GHRepository> getRepositoriesWithOpenPullRequests() throws IOException { public List<GHRepository> getRepositoriesWithOpenPullRequests() throws IOException {
List<GHRepository> r = new ArrayList<GHRepository>(); List<GHRepository> r = new ArrayList<GHRepository>();
for (GHRepository repository : listRepositories()) { for (GHRepository repository : listRepositories(100)) {
repository.wrap(root); repository.wrap(root);
List<GHPullRequest> pullRequests = repository.getPullRequests(GHIssueState.OPEN); List<GHPullRequest> pullRequests = repository.getPullRequests(GHIssueState.OPEN);
if (pullRequests.size() > 0) { if (pullRequests.size() > 0) {

View File

@@ -52,7 +52,7 @@ public abstract class GHPerson extends GHObject {
*/ */
public synchronized Map<String,GHRepository> getRepositories() throws IOException { public synchronized Map<String,GHRepository> getRepositories() throws IOException {
Map<String,GHRepository> repositories = new TreeMap<String, GHRepository>(); Map<String,GHRepository> repositories = new TreeMap<String, GHRepository>();
for (GHRepository r : listRepositories()) { for (GHRepository r : listRepositories(100)) {
repositories.put(r.getName(),r); repositories.put(r.getName(),r);
} }
return Collections.unmodifiableMap(repositories); return Collections.unmodifiableMap(repositories);