diff --git a/pom.xml b/pom.xml index 3a637f2227..25340a1c27 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ github-api - 1.77 + 1.78 GitHub API for Java http://github-api.kohsuke.org/ GitHub API for Java @@ -16,7 +16,7 @@ scm:git:git@github.com/kohsuke/${project.artifactId}.git scm:git:ssh://git@github.com/kohsuke/${project.artifactId}.git http://${project.artifactId}.kohsuke.org/ - github-api-1.77 + github-api-1.78 diff --git a/src/main/java/org/kohsuke/github/GHCommit.java b/src/main/java/org/kohsuke/github/GHCommit.java index 6e606ef603..5872233567 100644 --- a/src/main/java/org/kohsuke/github/GHCommit.java +++ b/src/main/java/org/kohsuke/github/GHCommit.java @@ -2,12 +2,12 @@ import com.infradna.tool.bridge_method_injector.WithBridgeMethods; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - import java.io.IOException; import java.net.URL; import java.util.AbstractList; import java.util.ArrayList; import java.util.Collections; +import java.util.Date; import java.util.List; /** @@ -42,11 +42,19 @@ public GitUser getAuthor() { return author; } + public Date getAuthoredDate() { + return GitHub.parseDate(author.date); + } + @WithBridgeMethods(value = GHAuthor.class, castRequired = true) public GitUser getCommitter() { return committer; } + public Date getCommitDate() { + return GitHub.parseDate(author.date); + } + /** * Commit message. */ @@ -63,6 +71,7 @@ public int getCommentCount() { * @deprecated Use {@link GitUser} instead. */ public static class GHAuthor extends GitUser { + private String date; } public static class Stats { @@ -272,10 +281,29 @@ public GHUser getAuthor() throws IOException { 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 { 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 { if (author==null || author.login==null) return null; return owner.root.getUser(author.login); diff --git a/src/main/java/org/kohsuke/github/GHOrganization.java b/src/main/java/org/kohsuke/github/GHOrganization.java index 0c62fd8a2a..f174decf2f 100644 --- a/src/main/java/org/kohsuke/github/GHOrganization.java +++ b/src/main/java/org/kohsuke/github/GHOrganization.java @@ -220,7 +220,7 @@ public GHTeam createTeam(String name, Permission p, GHRepository... repositories */ public List getRepositoriesWithOpenPullRequests() throws IOException { List r = new ArrayList(); - for (GHRepository repository : listRepositories()) { + for (GHRepository repository : listRepositories(100)) { repository.wrap(root); List pullRequests = repository.getPullRequests(GHIssueState.OPEN); if (pullRequests.size() > 0) { diff --git a/src/main/java/org/kohsuke/github/GHPerson.java b/src/main/java/org/kohsuke/github/GHPerson.java index ef93dd75aa..f8aae9a487 100644 --- a/src/main/java/org/kohsuke/github/GHPerson.java +++ b/src/main/java/org/kohsuke/github/GHPerson.java @@ -52,7 +52,7 @@ protected synchronized void populate() throws IOException { */ public synchronized Map getRepositories() throws IOException { Map repositories = new TreeMap(); - for (GHRepository r : listRepositories()) { + for (GHRepository r : listRepositories(100)) { repositories.put(r.getName(),r); } return Collections.unmodifiableMap(repositories);