/** * If this thread is about a commit, return that commit. * * @return null if this thread is not about a commit. */ public GHCommit getBoundCommit() throws IOException { if (!"Commit".equals(subject.type)) return null; return repository.getCommit(subject.url.substring(subject.url.lastIndexOf('/') + 1)); }
/** * If this thread is about a commit, return that commit. * * @return null if this thread is not about a commit. */ public GHCommit getBoundCommit() throws IOException { if (!"Commit".equals(subject.type)) return null; return repository.getCommit(subject.url.substring(subject.url.lastIndexOf('/') + 1)); }
/** * If this thread is about a commit, return that commit. * * @return null if this thread is not about a commit. */ public GHCommit getBoundCommit() throws IOException { if (!"Commit".equals(subject.type)) return null; return repository.getCommit(subject.url.substring(subject.url.lastIndexOf('/') + 1)); }
/** * Resolves the parent commit objects and return them. */ public List<GHCommit> getParents() throws IOException { List<GHCommit> r = new ArrayList<GHCommit>(); for (String sha1 : getParentSHA1s()) r.add(owner.getCommit(sha1)); return r; }
protected GitHubSCMFileSystem(@Nonnull GHRepository remoteRepo, GitHubSCMHead<?> head, GitHubSCMRevision rev) throws IOException { super(rev); this.remoteRepo = remoteRepo; this.commit = remoteRepo.getCommit(calculateHash(remoteRepo, head, rev)); }
/** * Resolves the parent commit objects and return them. */ public List<GHCommit> getParents() throws IOException { List<GHCommit> r = new ArrayList<GHCommit>(); for (String sha1 : getParentSHA1s()) r.add(owner.getCommit(sha1)); return r; }
/** * Resolves the parent commit objects and return them. */ public List<GHCommit> getParents() throws IOException { List<GHCommit> r = new ArrayList<GHCommit>(); for (String sha1 : getParentSHA1s()) r.add(owner.getCommit(sha1)); return r; }
/** * Obtains the commit that this pointer is referring to. */ public GHCommit getCommit() throws IOException { return getRepository().getCommit(getSha()); }
/** * Obtains the commit that this pointer is referring to. */ public GHCommit getCommit() throws IOException { return getRepository().getCommit(getSha()); }
/** * Gets the commit to which this comment is associated with. */ public GHCommit getCommit() throws IOException { return getOwner().getCommit(getSHA1()); }
private GHCommit commit() throws IOException { if (commit == null) { synchronized (this) { if (commit == null) { commit = repo().getCommit(revision.getHash()); } } } return commit; }
/** * Gets the commit to which this comment is associated with. */ public GHCommit getCommit() throws IOException { return getOwner().getCommit(getSHA1()); }
/** * Gets the commit to which this comment is associated with. */ public GHCommit getCommit() throws IOException { return getOwner().getCommit(getSHA1()); }
/** * Obtains the commit that this pointer is referring to. */ public GHCommit getCommit() throws IOException { return getRepository().getCommit(getSha()); }
private GHCommit getCommitFromSha(DynamicProject targetJob, String sha) { try { return new GithubRepositoryService(targetJob.getGithubRepoUrl()).getGithubRepository().getCommit(sha); } catch (IOException e) { throw new RuntimeException(e); } }
GHCommit getLastCommit(GHBranch remoteBranch) throws IOException { return remoteBranch.getOwner().getCommit(remoteBranch.getSHA1()); }
public Map<String, List<GHCommitStatus>> getCommitStatuses() throws IOException { final GHRepository githubRepository = this.build.getGithubRepository(); final List<GHCommitStatus> commitStatuses = githubRepository.getCommit(this.build.getSha()).listStatuses().asList(); final Map<String, List<GHCommitStatus>> groupedStatuses = new HashMap<>(); for (final GHCommitStatus status : commitStatuses) { final String context = status.getContext(); if (groupedStatuses.get(context) == null) { groupedStatuses.put(context, new ArrayList<>()); } groupedStatuses.get(context).add(status); } groupedStatuses.put("- Latest Status -", Arrays.asList(githubRepository.getLastCommitStatus(this.build.getSha()))); return groupedStatuses; } }
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; } } }
public org.kohsuke.github.GHCommit getHeadCommitForBranch(final String branch) throws IOException { String sha; final GitBranch gitBranch = new GitBranch(branch); if (gitBranch.isPullRequest()) { try { sha = getGithubRepository().getPullRequest(gitBranch.pullRequestNumber()).getHead().getSha(); } catch (final IOException e) { throw new RuntimeException(e); } } else { try { final GHRef ref = getRef("heads/" + gitBranch); sha = ref.getObject().getSha(); } catch (final IOException e) { sha = gitBranch.toString(); } } return getGithubRepository().getCommit(sha); }