当前位置: 首页>>代码示例>>Java>>正文


Java GHPullRequest.listCommits方法代码示例

本文整理汇总了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;
}
 
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:18,代码来源:GhprcPullRequestMerge.java

示例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;
  }
}
 
开发者ID:GerritCodeReview,项目名称:plugins_github,代码行数:16,代码来源:PullRequestListController.java

示例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();

}
 
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:34,代码来源:GhprcPullRequest.java

示例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;
  }
}
 
开发者ID:GerritCodeReview,项目名称:plugins_github,代码行数:44,代码来源:PullRequestImportJob.java


注:本文中的org.kohsuke.github.GHPullRequest.listCommits方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。