public Object[] getElements(Object inputElement) { return getCommits(mergeResult.getMergedCommits()); } });
private String createMessageAutoCommit(MergeResult mergeResult) { StringBuffer message = new StringBuffer("Auto merge commit between:"); for (Object commit : mergeResult.getMergedCommits()) { message.append(" ").append(((RevCommit)commit).getName().substring(0, 7));//no check for null } return message.toString(); }
private void performPullIfNecessary(Git git, PullRequest pr) throws GitAPIException, IOException { compareAndLogLocalAndRemoteBranches(git, pr); List<RevCommit> commitsInRemoteBranchOnlyBeforeWeDoAnything = getCommitsInBranchOnly(git, pr, false); List<RevCommit> commitsInLocalBranchOnlyBeforeWeDoAnything = getCommitsInBranchOnly(git, pr, true); if (commitsInRemoteBranchOnlyBeforeWeDoAnything.size() > commitsInLocalBranchOnlyBeforeWeDoAnything.size()) { log.info("more commits in remote branch than in local branch -> need for 'git pull'.."); PullResult pullResult = gitWrapper.pull(git); if (pullResult.isSuccessful()) { log.info("pull result OK - merged commits : "); Arrays.stream(pullResult.getMergeResult().getMergedCommits()).forEach(commit -> log.info("\t - {}", commit.toObjectId())); } else { String errorMessage = "unexpected things happened during simple pull operation"; log.warn(errorMessage); throw new CiDroidGitApiException(errorMessage); } compareAndLogLocalAndRemoteBranches(git, pr); } }