本文整理汇总了Java中org.kohsuke.github.GHPullRequest.listCommits方法的典型用法代码示例。如果您正苦于以下问题:Java GHPullRequest.listCommits方法的具体用法?Java GHPullRequest.listCommits怎么用?Java GHPullRequest.listCommits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kohsuke.github.GHPullRequest
的用法示例。
在下文中一共展示了GHPullRequest.listCommits方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isOwnCode
import org.kohsuke.github.GHPullRequest; //导入方法依赖的package包/类
private boolean isOwnCode(GHPullRequest pr, GHUser committer) {
try {
String commentorName = committer.getName();
for (GHPullRequestCommitDetail detail : pr.listCommits()) {
Commit commit = detail.getCommit();
String committerName = commit.getCommitter().getName();
if (committerName.equalsIgnoreCase(commentorName)) {
return true;
}
}
} catch (IOException e) {
logger.println("Unable to get committer name");
e.printStackTrace(logger);
}
return false;
}
示例2: isAnyCommitOfPullRequestToBeImported
import org.kohsuke.github.GHPullRequest; //导入方法依赖的package包/类
private boolean isAnyCommitOfPullRequestToBeImported(
ReviewDb db, Repository gitRepo, GHPullRequest ghPullRequest)
throws IncorrectObjectTypeException, IOException {
boolean pullRequestToImport = false;
try {
for (GHPullRequestCommitDetail pullRequestCommit : ghPullRequest.listCommits()) {
pullRequestToImport |=
qp.query(changeQuery.commit(pullRequestCommit.getSha())).entities().isEmpty();
}
return pullRequestToImport;
} catch (OrmException | QueryParseException e) {
LOG.error("Unable to query Gerrit changes for pull-request " + ghPullRequest.getNumber(), e);
return false;
}
}
示例3: tryBuild
import org.kohsuke.github.GHPullRequest; //导入方法依赖的package包/类
private void tryBuild(GHPullRequest pr) {
if (helper.isProjectDisabled()) {
logger.log(Level.INFO, "Project is disabled, not trying to build");
return;
}
logger.log(Level.INFO, "Running the build");
if (authorEmail == null) {
// If this instance was create before authorEmail was introduced (before v1.10), it can be null.
obtainAuthorEmail(pr);
logger.log(Level.INFO, "Author email was not set, trying to set it to {0}", authorEmail);
}
if (pr != null) {
logger.log(Level.INFO, "PR is not null, checking if mergable");
checkMergeable(pr);
try {
for (GHPullRequestCommitDetail commitDetails : pr.listCommits()) {
if (commitDetails.getSha().equals(getHead())) {
commitAuthor = commitDetails.getCommit().getCommitter();
break;
}
}
} catch (Exception ex) {
logger.log(Level.INFO, "Unable to get PR commits: ", ex);
}
}
logger.log(Level.INFO, "Running build...");
build();
}
示例4: addPullRequestToChange
import org.kohsuke.github.GHPullRequest; //导入方法依赖的package包/类
private List<Id> addPullRequestToChange(ReviewDb db, GHPullRequest pr, Repository gitRepo)
throws Exception {
String destinationBranch = REFS_HEADS + pr.getBase().getRef();
List<Id> prChanges = Lists.newArrayList();
ObjectId baseObjectId = ObjectId.fromString(pr.getBase().getSha());
ObjectId prHeadObjectId = ObjectId.fromString(pr.getHead().getSha());
try (RevWalk walk = new RevWalk(gitRepo)) {
walk.markUninteresting(walk.lookupCommit(baseObjectId));
walk.markStart(walk.lookupCommit(prHeadObjectId));
walk.sort(RevSort.REVERSE);
int patchNr = 1;
for (GHPullRequestCommitDetail ghCommitDetail : pr.listCommits()) {
status.update(
Code.SYNC,
"Patch #" + patchNr,
"Patch#" + patchNr + ": Inserting PullRequest into Gerrit");
RevCommit revCommit = walk.parseCommit(ObjectId.fromString(ghCommitDetail.getSha()));
GHUser prUser = pr.getUser();
GitUser commitAuthor = ghCommitDetail.getCommit().getAuthor();
GitHubUser gitHubUser = GitHubUser.from(prUser, commitAuthor);
Account.Id pullRequestOwner = getOrRegisterAccount(db, gitHubUser);
Id changeId =
createChange.addCommitToChange(
db,
project,
gitRepo,
destinationBranch,
pullRequestOwner,
revCommit,
getChangeMessage(pr),
String.format(TOPIC_FORMAT, new Integer(pr.getNumber())));
if (changeId != null) {
prChanges.add(changeId);
}
}
return prChanges;
}
}