/** * Use this method to walk the tree */ public GHTree getTree() throws IOException { return owner.getTree(getCommitShortInfo().tree.sha); }
/** * 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(); }
/** * Use this method to walk the tree */ public GHTree getTree() throws IOException { return owner.getTree(getCommitShortInfo().tree.sha); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
@Override public GitHubBranchCause doCheck(GHBranch remoteBranch, GitHubBranchRepository localRepo, GHCommit commit) throws IOException { List<String> messages = Arrays.asList(commit.getCommitShortInfo().getMessage()); return check(remoteBranch, localRepo, () -> messages); }
Properties props = new Properties(); props.setProperty("login", "somebody@somewhere.com"); props.setProperty("password", "YourGithubPassword"); GitHub gitHub = GitHubBuilder.fromProperties(props).build(); GHRepository repository = gitHub.getRepository("your/repo"); Calendar cal = Calendar.getInstance(); cal.set(2014, 0, 4); Date since = cal.getTime(); cal.set(2014, 0, 14); Date until = cal.getTime(); GHCommitQueryBuilder queryBuilder = repository.queryCommits().since(since).until(until); PagedIterable<GHCommit> commits = queryBuilder.list(); Iterator<GHCommit> iterator = commits.iterator(); while (iterator.hasNext()) { GHCommit commit = iterator.next(); System.out.println("Commit: " + commit.getSHA1() + ", info: " + commit.getCommitShortInfo().getMessage() + ", author: " + commit.getAuthor()); }
public GithubLogEntry(final GHCommit commit) throws IOException { this.message = commit.getCommitShortInfo().getMessage(); this.githubUrl = commit.getHtmlUrl().toExternalForm(); this.commitId = commit.getSHA1(); this.affectedPaths = commit.getFiles().stream().map(file -> file.getFileName()).collect(Collectors.toList()); }
public CommitInfo(final GHCommit commit, final GitBranch branch) { this.sha = commit.getSHA1(); try { this.message = commit.getCommitShortInfo().getMessage(); this.committerName = commit.getCommitShortInfo().getCommitter().getName(); this.committerEmail = commit.getCommitShortInfo().getCommitter().getEmail(); this.commitUrl = commit.getOwner().getHtmlUrl() + "/commit/" + this.sha; } catch (final IOException e) { throw new RuntimeException(e); } this.branch = branch.toString(); this.avatarUrl = null; }
public Optional<CommitDetails> getCommitDetails(String githubRepo, String sha) { try { logger.info("Getting commit details for sha {} on url {}", sha, githubRepo); GHCommit commit = gitHub.getRepository(githubRepo).getCommit(sha); GHUser author = commit.getAuthor(); String committerName = (author == null) ? null : author.getName(); if (committerName == null || committerName.isEmpty()) { committerName = author.getLogin(); } CommitDetails commitDetails = new CommitDetails(sha, commit.getHtmlUrl().toString(), commit.getCommitShortInfo().getMessage(), commit.getCommitDate(), commit.getLastStatus(), author.getAvatarUrl(), committerName); return Optional.of(commitDetails); } catch (IOException e) { logger.warn("Could not get commit details from Github!", e); return Optional.empty(); } }
public GHCommit.ShortInfo getShortInfo(Build build) { Repository repository = build.getRepository(); Commit commit = build.getCommit(); try { GitHub gitHub = this.getjTravis().getGithub(); GHRepository ghRepository = gitHub.getRepository(repository.getSlug()); GHCommit ghCommit = ghRepository.getCommit(commit.getSha()); return ghCommit.getCommitShortInfo(); } catch (IOException e) { getLogger().error("Error while getting short information from build", e); return null; } } }