Search in sources :

Example 1 with GitCommitCompareInfo

use of git4idea.util.GitCommitCompareInfo in project intellij-community by JetBrains.

the class GitBranchWorker method loadCommitsToCompare.

private GitCommitCompareInfo loadCommitsToCompare(List<GitRepository> repositories, String branchName) {
    GitCommitCompareInfo compareInfo = new GitCommitCompareInfo();
    for (GitRepository repository : repositories) {
        compareInfo.put(repository, loadCommitsToCompare(repository, branchName));
        compareInfo.put(repository, loadTotalDiff(repository, branchName));
    }
    return compareInfo;
}
Also used : GitCommitCompareInfo(git4idea.util.GitCommitCompareInfo) GitRepository(git4idea.repo.GitRepository)

Example 2 with GitCommitCompareInfo

use of git4idea.util.GitCommitCompareInfo in project intellij-community by JetBrains.

the class GithubCreatePullRequestWorker method doLoadDiffInfo.

@NotNull
private DiffInfo doLoadDiffInfo(@NotNull final BranchInfo branch) throws VcsException {
    // TODO: make cancelable and abort old speculative requests (when git4idea will allow to do so)
    String currentBranch = myCurrentBranch;
    String targetBranch = branch.getForkInfo().getRemoteName() + "/" + branch.getRemoteName();
    List<GitCommit> commits1 = GitHistoryUtils.history(myProject, myGitRepository.getRoot(), ".." + targetBranch);
    List<GitCommit> commits2 = GitHistoryUtils.history(myProject, myGitRepository.getRoot(), targetBranch + "..");
    Collection<Change> diff = GitChangeUtils.getDiff(myProject, myGitRepository.getRoot(), targetBranch, myCurrentBranch, null);
    GitCommitCompareInfo info = new GitCommitCompareInfo(GitCommitCompareInfo.InfoType.BRANCH_TO_HEAD);
    info.put(myGitRepository, diff);
    info.put(myGitRepository, Couple.of(commits1, commits2));
    return new DiffInfo(info, currentBranch, targetBranch);
}
Also used : GitCommitCompareInfo(git4idea.util.GitCommitCompareInfo) GitCommit(git4idea.GitCommit) Change(com.intellij.openapi.vcs.changes.Change) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with GitCommitCompareInfo

use of git4idea.util.GitCommitCompareInfo in project intellij-community by JetBrains.

the class GitBranchWorker method compare.

public void compare(@NotNull final String branchName, @NotNull final List<GitRepository> repositories, @NotNull final GitRepository selectedRepository) {
    final GitCommitCompareInfo myCompareInfo = loadCommitsToCompare(repositories, branchName);
    if (myCompareInfo == null) {
        LOG.error("The task to get compare info didn't finish. Repositories: \n" + repositories + "\nbranch name: " + branchName);
        return;
    }
    ApplicationManager.getApplication().invokeLater(new Runnable() {

        @Override
        public void run() {
            displayCompareDialog(branchName, GitBranchUtil.getCurrentBranchOrRev(repositories), myCompareInfo, selectedRepository);
        }
    });
}
Also used : GitCommitCompareInfo(git4idea.util.GitCommitCompareInfo)

Aggregations

GitCommitCompareInfo (git4idea.util.GitCommitCompareInfo)3 Change (com.intellij.openapi.vcs.changes.Change)1 GitCommit (git4idea.GitCommit)1 GitRepository (git4idea.repo.GitRepository)1 NotNull (org.jetbrains.annotations.NotNull)1