From e171fdf6840c4b59cbe40a777de3f02493b99148 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 16 Oct 2012 18:00:12 +0400 Subject: [PATCH] GitBranch: move getMergeBase to the only class using it --- plugins/git4idea/src/git4idea/GitBranch.java | 16 ---------------- .../changes/GitOutgoingChangesProvider.java | 18 +++++++++++++++--- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/plugins/git4idea/src/git4idea/GitBranch.java b/plugins/git4idea/src/git4idea/GitBranch.java index e3b87f637fbb..e8b9934b8c0f 100644 --- a/plugins/git4idea/src/git4idea/GitBranch.java +++ b/plugins/git4idea/src/git4idea/GitBranch.java @@ -21,7 +21,6 @@ import com.intellij.openapi.util.Pair; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vfs.VirtualFile; import git4idea.config.GitConfigUtil; -import git4idea.history.GitHistoryUtils; import git4idea.repo.GitRepositoryFiles; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -200,19 +199,4 @@ public class GitBranch extends GitReference { } return new GitBranch(branch, remoteFlag); } - - /** - * Get a merge base between the current branch and specified branch. - * - * @param project the current project - * @param root the vcs root - * @param branch the branch - * @return the common commit or null if the there is no common commit - * @throws VcsException the exception - */ - @Nullable - public GitRevisionNumber getMergeBase(@NotNull Project project, @NotNull VirtualFile root, @NotNull GitBranch branch) - throws VcsException { - return GitHistoryUtils.getMergeBase(project, root, this.getFullName(), branch.getFullName()); - } } diff --git a/plugins/git4idea/src/git4idea/changes/GitOutgoingChangesProvider.java b/plugins/git4idea/src/git4idea/changes/GitOutgoingChangesProvider.java index 918e853f1e51..cc641808d81b 100644 --- a/plugins/git4idea/src/git4idea/changes/GitOutgoingChangesProvider.java +++ b/plugins/git4idea/src/git4idea/changes/GitOutgoingChangesProvider.java @@ -25,12 +25,14 @@ import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.Consumer; import com.intellij.util.containers.Convertor; +import git4idea.GitBranch; import git4idea.GitBranchesSearcher; import git4idea.GitRevisionNumber; import git4idea.GitUtil; import git4idea.commands.GitSimpleHandler; import git4idea.history.GitHistoryUtils; import git4idea.history.browser.SHAHash; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.*; @@ -50,7 +52,7 @@ public class GitOutgoingChangesProvider implements VcsOutgoingChangesProvider>(null, Collections.emptyList()); } - final GitRevisionNumber base = searcher.getLocal().getMergeBase(myProject, vcsRoot, searcher.getRemote()); + final GitRevisionNumber base = getMergeBase(myProject, vcsRoot, searcher.getLocal(), searcher.getRemote()); if (base == null) { return new Pair>(null, Collections.emptyList()); } @@ -82,7 +84,7 @@ public class GitOutgoingChangesProvider implements VcsOutgoingChangesProvider(localChanges); @@ -133,4 +135,14 @@ public class GitOutgoingChangesProvider implements VcsOutgoingChangesProvider