use of com.intellij.dvcs.push.OutgoingResult in project intellij-community by JetBrains.
the class GitOutgoingCommitsProvider method getOutgoingCommits.
@NotNull
@Override
public OutgoingResult getOutgoingCommits(@NotNull GitRepository repository, @NotNull PushSpec<GitPushSource, GitPushTarget> pushSpec, boolean initial) {
GitLocalBranch branch = pushSpec.getSource().getBranch();
String source = branch.equals(repository.getCurrentBranch()) ? HEAD : branch.getFullName();
GitPushTarget target = pushSpec.getTarget();
String destination = target.getBranch().getFullName();
try {
List<GitCommit> commits;
if (!target.isNewBranchCreated()) {
commits = GitHistoryUtils.history(myProject, repository.getRoot(), destination + ".." + source);
} else {
commits = GitHistoryUtils.history(myProject, repository.getRoot(), source, "--not", "--remotes=" + target.getBranch().getRemote().getName(), "--max-count=" + 1000);
}
return new OutgoingResult(commits, Collections.<VcsError>emptyList());
} catch (VcsException e) {
return new OutgoingResult(Collections.<VcsFullCommitDetails>emptyList(), Collections.singletonList(new VcsError(GitUtil.cleanupErrorPrefixes(e.getMessage()))));
}
}
Aggregations