OutgoingResult (@NotNull GitRepository repository, @NotNull PushSpec<GitPushSource, GitPushTarget> pushSpec, boolean initial) { GitPushSource gitPushSource = pushSpec.getSource(); String source = gitPushSource.getRevision(); 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.emptyList()); } catch (VcsException e) { return new OutgoingResult(Collections.emptyList(), Collections.singletonList(new VcsError(GitUtil.cleanupErrorPrefixes(e.getMessage())))); } }