Remove unused logic of populating affectedRoots list

It used to refresh the roots from the list later, but that does't
happen anymore.
This commit is contained in:
Kirill Likhodedov
2016-10-19 16:55:10 +03:00
parent 8eeb77ad1e
commit 30ef962678
7 changed files with 2 additions and 22 deletions
@@ -28,7 +28,6 @@ import git4idea.update.GitFetcher;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.Set;
public class GitFetch extends GitRepositoryAction {
@Override
@@ -40,7 +39,6 @@ public class GitFetch extends GitRepositoryAction {
protected void perform(@NotNull final Project project,
@NotNull final List<VirtualFile> gitRoots,
@NotNull final VirtualFile defaultRoot,
final Set<VirtualFile> affectedRoots,
final List<VcsException> exceptions) throws VcsException {
GitVcs.runInBackground(new Task.Backgroundable(project, "Fetching...", true) {
@Override
@@ -42,7 +42,6 @@ import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import static git4idea.commands.GitLocalChangesWouldBeOverwrittenDetector.Operation.MERGE;
@@ -66,7 +65,6 @@ abstract class GitMergeAction extends GitRepositoryAction {
protected void perform(@NotNull final Project project,
@NotNull final List<VirtualFile> gitRoots,
@NotNull final VirtualFile defaultRoot,
final Set<VirtualFile> affectedRoots,
final List<VcsException> exceptions) throws VcsException {
final DialogState dialogState = displayDialog(project, gitRoots, defaultRoot);
if (dialogState == null) {
@@ -35,9 +35,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static com.intellij.util.ObjectUtils.notNull;
@@ -55,11 +53,10 @@ public abstract class GitRepositoryAction extends DumbAwareAction {
if (roots == null) return;
final VirtualFile defaultRoot = getDefaultRoot(project, roots, e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY));
final Set<VirtualFile> affectedRoots = new HashSet<>();
List<VcsException> exceptions = new ArrayList<>();
try {
perform(project, roots, defaultRoot, affectedRoots, exceptions);
perform(project, roots, defaultRoot, exceptions);
}
catch (VcsException ex) {
exceptions.add(ex);
@@ -131,14 +128,12 @@ public abstract class GitRepositoryAction extends DumbAwareAction {
* @param project a context project
* @param gitRoots a git roots that affect the current project (sorted by {@link VirtualFile#getPresentableUrl()})
* @param defaultRoot a guessed default root (based on the currently selected file list)
* @param affectedRoots a set of roots affected by the action
* @param exceptions a list of exceptions from running git
* @throws VcsException if there is a problem with running git (this exception is considered to be added to the end of the exception list)
*/
protected abstract void perform(@NotNull Project project,
@NotNull List<VirtualFile> gitRoots,
@NotNull VirtualFile defaultRoot,
final Set<VirtualFile> affectedRoots,
List<VcsException> exceptions) throws VcsException;
@Override
@@ -21,7 +21,6 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ArrayUtil;
import git4idea.GitUtil;
import git4idea.commands.GitHandlerUtil;
import git4idea.commands.GitLineHandler;
@@ -31,7 +30,6 @@ import git4idea.ui.GitResetDialog;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.Set;
/**
* The reset action
@@ -51,14 +49,12 @@ public class GitResetHead extends GitRepositoryAction {
protected void perform(@NotNull Project project,
@NotNull List<VirtualFile> gitRoots,
@NotNull VirtualFile defaultRoot,
Set<VirtualFile> affectedRoots,
List<VcsException> exceptions) throws VcsException {
GitResetDialog d = new GitResetDialog(project, gitRoots, defaultRoot);
if (!d.showAndGet()) {
return;
}
GitLineHandler h = d.handler();
affectedRoots.add(d.getGitRoot());
AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
GitHandlerUtil.doSynchronously(h, GitBundle.getString("resetting.title"), h.printableCommandLine());
@@ -68,7 +64,7 @@ public class GitResetHead extends GitRepositoryAction {
}
GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
manager.updateRepository(d.getGitRoot());
VfsUtil.markDirtyAndRefresh(true, true, false, ArrayUtil.toObjectArray(affectedRoots, VirtualFile.class));
VfsUtil.markDirtyAndRefresh(true, true, false, d.getGitRoot());
showErrors(project, getActionName(), exceptions);
}
}
@@ -29,7 +29,6 @@ import git4idea.ui.GitStashDialog;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.Set;
/**
* Git stash action
@@ -42,7 +41,6 @@ public class GitStash extends GitRepositoryAction {
protected void perform(@NotNull final Project project,
@NotNull final List<VirtualFile> gitRoots,
@NotNull final VirtualFile defaultRoot,
final Set<VirtualFile> affectedRoots,
final List<VcsException> exceptions) throws VcsException {
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
if (changeListManager.isFreezedWithNotification("Can not stash changes now")) return;
@@ -51,7 +49,6 @@ public class GitStash extends GitRepositoryAction {
return;
}
VirtualFile root = d.getGitRoot();
affectedRoots.add(root);
final GitLineHandler h = d.handler();
AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
@@ -23,7 +23,6 @@ import git4idea.ui.GitTagDialog;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.Set;
/**
* Git "tag" action
@@ -44,7 +43,6 @@ public class GitTag extends GitRepositoryAction {
protected void perform(@NotNull final Project project,
@NotNull final List<VirtualFile> gitRoots,
@NotNull final VirtualFile defaultRoot,
final Set<VirtualFile> affectedRoots,
final List<VcsException> exceptions) throws VcsException {
GitTagDialog d = new GitTagDialog(project, gitRoots, defaultRoot);
if (!d.showAndGet()) {
@@ -24,7 +24,6 @@ import git4idea.ui.GitUnstashDialog;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.Set;
/**
* Git unstash action
@@ -45,7 +44,6 @@ public class GitUnstash extends GitRepositoryAction {
protected void perform(@NotNull final Project project,
@NotNull final List<VirtualFile> gitRoots,
@NotNull final VirtualFile defaultRoot,
final Set<VirtualFile> affectedRoots,
final List<VcsException> exceptions) throws VcsException {
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
if (changeListManager.isFreezedWithNotification("Can not unstash changes now")) return;