From d5223f0f78ff4279e2582965627d6373cbd9ce95 Mon Sep 17 00:00:00 2001
From: Kirill Likhodedov
Date: Mon, 2 May 2016 15:31:30 +0300
Subject: [PATCH] git: get rid of GitPlatformFacade as not valuable anymore
The interface was introduce as an attempt to separate git (dvcs) module
from the rest of the platform, to be able to write module tests
(faster and more reliable than the full-platform one).
However, the idea didn't proove itself: it appeared to be too tedious
to substitute all platform references by the facade methods, while
the platform tests became faster and used now pretty well.
Substitute the usages by actual calls to the platform methods.
Remove GPF usages and methods, or deprecate those which are called
by 3-party plugins.
---
.../com/intellij/dvcs/DvcsPlatformFacade.java | 102 -------------
.../intellij/dvcs/DvcsPlatformFacadeImpl.java | 139 ------------------
.../util/CloudGitDeploymentRuntime.java | 4 +-
.../src/git4idea/GitPlatformFacade.java | 30 ++--
.../src/git4idea/GitPlatformFacadeImpl.java | 28 ++--
.../src/git4idea/actions/GitStash.java | 5 +-
.../GitBranchIsNotFullyMergedDialog.java | 5 +-
.../git4idea/branch/GitBranchOperation.java | 16 +-
.../branch/GitBranchUiHandlerImpl.java | 6 +-
.../src/git4idea/branch/GitBranchWorker.java | 21 +--
.../src/git4idea/branch/GitBrancherImpl.java | 7 +-
.../branch/GitCheckoutNewBranchOperation.java | 5 +-
.../git4idea/branch/GitCheckoutOperation.java | 6 +-
.../branch/GitDeleteBranchOperation.java | 7 +-
.../GitDeleteRemoteBranchOperation.java | 7 +-
.../git4idea/branch/GitMergeOperation.java | 15 +-
.../branch/GitRenameBranchOperation.java | 3 +-
.../branch/GitSmartOperationDialog.java | 5 +-
.../checkin/GitCheckinHandlerFactory.java | 4 +-
.../git4idea/cherrypick/GitCherryPicker.java | 49 +++---
.../crlf/GitCrlfProblemsDetector.java | 20 +--
.../log/GitShowExternalLogAction.java | 2 -
.../git4idea/merge/GitConflictResolver.java | 32 ++--
.../GitMergeCommittingConflictResolver.java | 4 +-
.../src/git4idea/push/GitPushOperation.java | 4 +-
.../rebase/GitAbortRebaseProcess.java | 3 +-
.../src/git4idea/rebase/GitRebaseProcess.java | 11 +-
.../src/git4idea/rebase/GitRebaseSpec.java | 4 +-
.../src/git4idea/rebase/GitRebaser.java | 6 +-
.../git4idea/src/git4idea/repo/GitConfig.java | 7 +-
.../git4idea/src/git4idea/repo/GitRemote.java | 3 +-
.../git4idea/repo/GitRepositoryCreator.java | 5 +-
.../src/git4idea/repo/GitRepositoryImpl.java | 10 +-
.../git4idea/repo/GitRepositoryManager.java | 25 +++-
.../src/git4idea/reset/GitResetOperation.java | 7 +-
.../src/git4idea/stash/GitChangesSaver.java | 12 +-
.../git4idea/stash/GitShelveChangesSaver.java | 13 +-
.../git4idea/stash/GitStashChangesSaver.java | 13 +-
.../src/git4idea/ui/GitUnstashDialog.java | 8 +-
.../GitLogBranchOperationsActionGroup.java | 5 +-
.../src/git4idea/update/GitMergeUpdater.java | 2 +-
.../git4idea/update/GitUpdateEnvironment.java | 6 +-
.../src/git4idea/update/GitUpdateProcess.java | 8 +-
.../src/git4idea/util/GitFreezingProcess.java | 48 +++---
.../git4idea/util/GitPreservingProcess.java | 8 +-
.../test-stepdefs/git4idea/GitAddSteps.java | 3 +-
.../git4idea/GitCherryPickStepdefs.java | 8 +-
.../git4idea/GitCucumberWorld.java | 9 +-
.../git4idea/branch/GitBranchWorkerTest.java | 16 +-
.../crlf/GitCrlfProblemsDetectorTest.java | 4 +-
.../git4idea/rebase/GitMultiRepoRebaseTest.kt | 2 +-
.../rebase/GitSingleRepoRebaseTest.kt | 2 +-
.../tests/git4idea/repo/GitConfigTest.java | 8 +-
.../repo/GitRepositoryReaderNewTest.kt | 2 +-
.../repo/GitRepositoryReaderTest.java | 2 +-
.../tests/git4idea/test/GitPlatformTest.kt | 3 -
.../plugins/github/GithubRebaseAction.java | 4 +-
57 files changed, 257 insertions(+), 536 deletions(-)
delete mode 100644 platform/dvcs-impl/src/com/intellij/dvcs/DvcsPlatformFacade.java
delete mode 100644 platform/dvcs-impl/src/com/intellij/dvcs/DvcsPlatformFacadeImpl.java
diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/DvcsPlatformFacade.java b/platform/dvcs-impl/src/com/intellij/dvcs/DvcsPlatformFacade.java
deleted file mode 100644
index 91adfa23dd92..000000000000
--- a/platform/dvcs-impl/src/com/intellij/dvcs/DvcsPlatformFacade.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright 2000-2012 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.dvcs;
-
-import com.intellij.ide.SaveAndSyncHandler;
-import com.intellij.ide.plugins.IdeaPluginDescriptor;
-import com.intellij.openapi.application.ModalityState;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.project.ex.ProjectManagerEx;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.vcs.AbstractVcs;
-import com.intellij.openapi.vcs.AbstractVcsHelper;
-import com.intellij.openapi.vcs.ProjectLevelVcsManager;
-import com.intellij.openapi.vcs.changes.ChangeListManagerEx;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VirtualFile;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * IntelliJ code provides a lot of statical bindings to the interested pieces of data. For example we need to execute code
- * like below to get list of modules for the target project:
- *
- * ModuleManager.getInstance(project).getModules()
- *
- * That means that it's not possible to test target classes in isolation if corresponding infrastructure is not set up.
- * However, we don't want to set it up if we execute a simple standalone test.
- *
- * This interface is intended to encapsulate access to the underlying IntelliJ functionality.
- *
- * Implementations of this interface are expected to be thread-safe.
- *
- * @author Kirill Likhodedov
- */
-public interface DvcsPlatformFacade {
-
- @NotNull
- AbstractVcs getVcs(@NotNull Project project);
-
- @NotNull
- ProjectLevelVcsManager getVcsManager(@NotNull Project project);
-
- void showDialog(@NotNull DialogWrapper dialog);
-
- @NotNull
- ProjectRootManager getProjectRootManager(@NotNull Project project);
-
- /**
- * Invokes {@link com.intellij.openapi.application.Application#runReadAction(Computable)}.
- */
- T runReadAction(@NotNull Computable computable);
-
- void runReadAction(@NotNull Runnable runnable);
-
- void runWriteAction(@NotNull Runnable runnable);
-
- void invokeAndWait(@NotNull Runnable runnable, @NotNull ModalityState modalityState);
-
- void executeOnPooledThread(@NotNull Runnable runnable);
-
- ChangeListManagerEx getChangeListManager(@NotNull Project project);
-
- LocalFileSystem getLocalFileSystem();
-
- @NotNull
- AbstractVcsHelper getVcsHelper(@NotNull Project project);
-
- @Nullable
- IdeaPluginDescriptor getPluginByClassName(@NotNull String name);
-
- /**
- * Gets line separator of the given virtual file.
- * If {@code detect} is set {@code true}, and the information about line separator wasn't retrieved yet, loads the file and detects.
- */
- @Nullable
- String getLineSeparator(@NotNull VirtualFile file, boolean detect);
-
- void saveAllDocuments();
-
- @NotNull
- ProjectManagerEx getProjectManager();
-
- @NotNull
- SaveAndSyncHandler getSaveAndSyncHandler();
-
- void hardRefresh(@NotNull VirtualFile root);
-}
diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/DvcsPlatformFacadeImpl.java b/platform/dvcs-impl/src/com/intellij/dvcs/DvcsPlatformFacadeImpl.java
deleted file mode 100644
index 307b6053ee7d..000000000000
--- a/platform/dvcs-impl/src/com/intellij/dvcs/DvcsPlatformFacadeImpl.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright 2000-2015 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.dvcs;
-
-import com.intellij.ide.SaveAndSyncHandler;
-import com.intellij.ide.plugins.IdeaPluginDescriptor;
-import com.intellij.ide.plugins.PluginManager;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.application.ModalityState;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.project.ex.ProjectManagerEx;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.vcs.AbstractVcsHelper;
-import com.intellij.openapi.vcs.ProjectLevelVcsManager;
-import com.intellij.openapi.vcs.changes.ChangeListManager;
-import com.intellij.openapi.vcs.changes.ChangeListManagerEx;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VfsUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import static com.intellij.openapi.application.ModalityState.defaultModalityState;
-
-/**
- * @author Kirill Likhodedov
- */
-public abstract class DvcsPlatformFacadeImpl implements DvcsPlatformFacade {
-
- @NotNull
- @Override
- public ProjectLevelVcsManager getVcsManager(@NotNull Project project) {
- return ProjectLevelVcsManager.getInstance(project);
- }
-
- @Override
- public void showDialog(@NotNull DialogWrapper dialog) {
- dialog.show();
- }
-
- @NotNull
- @Override
- public ProjectRootManager getProjectRootManager(@NotNull Project project) {
- return ProjectRootManager.getInstance(project);
- }
-
- @Override
- public T runReadAction(@NotNull Computable computable) {
- return ApplicationManager.getApplication().runReadAction(computable);
- }
-
- @Override
- public void runReadAction(@NotNull Runnable runnable) {
- ApplicationManager.getApplication().runReadAction(runnable);
- }
-
- @Override
- public void runWriteAction(@NotNull Runnable runnable) {
- ApplicationManager.getApplication().runWriteAction(runnable);
- }
-
- @Override
- public void invokeAndWait(@NotNull Runnable runnable, @NotNull ModalityState modalityState) {
- ApplicationManager.getApplication().invokeAndWait(runnable, modalityState);
- }
-
- @Override
- public void executeOnPooledThread(@NotNull Runnable runnable) {
- ApplicationManager.getApplication().executeOnPooledThread(runnable);
- }
-
- @Override
- public ChangeListManagerEx getChangeListManager(@NotNull Project project) {
- return (ChangeListManagerEx)ChangeListManager.getInstance(project);
- }
-
- @Override
- public LocalFileSystem getLocalFileSystem() {
- return LocalFileSystem.getInstance();
- }
-
- @NotNull
- @Override
- public AbstractVcsHelper getVcsHelper(@NotNull Project project) {
- return AbstractVcsHelper.getInstance(project);
- }
-
- @Nullable
- @Override
- public IdeaPluginDescriptor getPluginByClassName(@NotNull String name) {
- return PluginManager.getPlugin(PluginManager.getPluginByClassName(name));
- }
-
- @Nullable
- @Override
- public String getLineSeparator(@NotNull VirtualFile file, boolean detect) {
- return LoadTextUtil.detectLineSeparator(file, detect);
- }
-
- @Override
- public void saveAllDocuments() {
- ApplicationManager.getApplication().invokeAndWait(() -> FileDocumentManager.getInstance().saveAllDocuments(), defaultModalityState());
- }
-
- @NotNull
- @Override
- public ProjectManagerEx getProjectManager() {
- return ProjectManagerEx.getInstanceEx();
- }
-
- @NotNull
- @Override
- public SaveAndSyncHandler getSaveAndSyncHandler() {
- return SaveAndSyncHandler.getInstance();
- }
-
- @Override
- public void hardRefresh(@NotNull VirtualFile root) {
- VfsUtil.markDirtyAndRefresh(false, true, false, root);
- }
-
-}
diff --git a/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/CloudGitDeploymentRuntime.java b/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/CloudGitDeploymentRuntime.java
index 86fe721c8a1e..eabb0aeaa2ea 100644
--- a/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/CloudGitDeploymentRuntime.java
+++ b/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/CloudGitDeploymentRuntime.java
@@ -24,7 +24,6 @@ import com.intellij.remoteServer.runtime.deployment.DeploymentLogManager;
import com.intellij.remoteServer.runtime.deployment.DeploymentTask;
import com.intellij.util.ArrayUtil;
import com.intellij.util.concurrency.Semaphore;
-import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
import git4idea.actions.GitInit;
import git4idea.commands.*;
@@ -161,8 +160,7 @@ public class CloudGitDeploymentRuntime extends CloudDeploymentRuntime {
if (myGit == null) {
throw new ServerRuntimeException("Can't initialize GIT");
}
- GitPlatformFacade gitPlatformFacade = ServiceManager.getService(GitPlatformFacade.class);
- myChangeListManager = gitPlatformFacade.getChangeListManager(project);
+ myChangeListManager = ChangeListManagerImpl.getInstanceImpl(project);
}
@Override
diff --git a/plugins/git4idea/src/git4idea/GitPlatformFacade.java b/plugins/git4idea/src/git4idea/GitPlatformFacade.java
index 450936045fd7..c11d19738712 100644
--- a/plugins/git4idea/src/git4idea/GitPlatformFacade.java
+++ b/plugins/git4idea/src/git4idea/GitPlatformFacade.java
@@ -15,18 +15,30 @@
*/
package git4idea;
-import com.intellij.dvcs.DvcsPlatformFacade;
-import com.intellij.dvcs.repo.RepositoryManager;
import com.intellij.openapi.project.Project;
-import git4idea.config.GitVcsSettings;
-import git4idea.repo.GitRepository;
+import com.intellij.openapi.vcs.changes.ChangeListManager;
+import com.intellij.openapi.vcs.changes.ChangeListManagerEx;
+import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
-public interface GitPlatformFacade extends DvcsPlatformFacade {
+/**
+ * @deprecated To remove in IDEA 2017. Use direct instance or ServiceManager methods to access platform structures.
+ */
+@Deprecated
+public interface GitPlatformFacade {
- @NotNull
- > T getRepositoryManager(@NotNull Project project);
+ /**
+ * @deprecated To remove in IDEA 2017. Use {@link ChangeListManager#getInstance(Project)}.
+ */
+ @SuppressWarnings("unused")
+ @Deprecated
+ ChangeListManagerEx getChangeListManager(@NotNull Project project);
- @NotNull
- GitVcsSettings getSettings(Project project);
+ /**
+ * @deprecated To remove in IDEA 2017. Use {@link VfsUtil#markDirtyAndRefresh(boolean, boolean, boolean, VirtualFile...)}.
+ */
+ @SuppressWarnings("unused")
+ @Deprecated
+ void hardRefresh(@NotNull VirtualFile root);
}
diff --git a/plugins/git4idea/src/git4idea/GitPlatformFacadeImpl.java b/plugins/git4idea/src/git4idea/GitPlatformFacadeImpl.java
index 24b0d5387b72..608dab12ecca 100644
--- a/plugins/git4idea/src/git4idea/GitPlatformFacadeImpl.java
+++ b/plugins/git4idea/src/git4idea/GitPlatformFacadeImpl.java
@@ -15,32 +15,22 @@
*/
package git4idea;
-import com.intellij.dvcs.DvcsPlatformFacadeImpl;
-import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vcs.AbstractVcs;
-import com.intellij.openapi.vcs.ProjectLevelVcsManager;
-import git4idea.config.GitVcsSettings;
-import git4idea.repo.GitRepositoryManager;
+import com.intellij.openapi.vcs.changes.ChangeListManager;
+import com.intellij.openapi.vcs.changes.ChangeListManagerEx;
+import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
-class GitPlatformFacadeImpl extends DvcsPlatformFacadeImpl implements GitPlatformFacade {
+public class GitPlatformFacadeImpl implements GitPlatformFacade {
- @NotNull
@Override
- public AbstractVcs getVcs(@NotNull Project project) {
- return ProjectLevelVcsManager.getInstance(project).findVcsByName(GitVcs.NAME);
+ public ChangeListManagerEx getChangeListManager(@NotNull Project project) {
+ return (ChangeListManagerEx)ChangeListManager.getInstance(project);
}
- @NotNull
@Override
- public GitRepositoryManager getRepositoryManager(@NotNull Project project) {
- return ServiceManager.getService(project, GitRepositoryManager.class);
- }
-
- @NotNull
- @Override
- public GitVcsSettings getSettings(@NotNull Project project) {
- return GitVcsSettings.getInstance(project);
+ public void hardRefresh(@NotNull VirtualFile root) {
+ VfsUtil.markDirtyAndRefresh(false, true, false, root);
}
}
diff --git a/plugins/git4idea/src/git4idea/actions/GitStash.java b/plugins/git4idea/src/git4idea/actions/GitStash.java
index 7c9540ebe344..cf1514c8069c 100644
--- a/plugins/git4idea/src/git4idea/actions/GitStash.java
+++ b/plugins/git4idea/src/git4idea/actions/GitStash.java
@@ -17,12 +17,11 @@ package git4idea.actions;
import com.intellij.dvcs.DvcsUtil;
import com.intellij.openapi.application.AccessToken;
-import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.ChangeListManager;
+import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
-import git4idea.GitPlatformFacade;
import git4idea.commands.GitHandlerUtil;
import git4idea.commands.GitLineHandler;
import git4idea.i18n.GitBundle;
@@ -61,7 +60,7 @@ public class GitStash extends GitRepositoryAction {
finally {
DvcsUtil.workingTreeChangeFinished(project, token);
}
- ServiceManager.getService(project, GitPlatformFacade.class).hardRefresh(root);
+ VfsUtil.markDirtyAndRefresh(false, true, false, root);
}
/**
diff --git a/plugins/git4idea/src/git4idea/branch/GitBranchIsNotFullyMergedDialog.java b/plugins/git4idea/src/git4idea/branch/GitBranchIsNotFullyMergedDialog.java
index 56d98305ba10..f85177c1f965 100644
--- a/plugins/git4idea/src/git4idea/branch/GitBranchIsNotFullyMergedDialog.java
+++ b/plugins/git4idea/src/git4idea/branch/GitBranchIsNotFullyMergedDialog.java
@@ -15,7 +15,6 @@
*/
package git4idea.branch;
-import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
@@ -23,9 +22,9 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.components.JBLabel;
import com.intellij.util.ArrayUtil;
import com.intellij.xml.util.XmlStringUtil;
+import git4idea.DialogManager;
import git4idea.GitBranch;
import git4idea.GitCommit;
-import git4idea.GitPlatformFacade;
import git4idea.i18n.GitBundle;
import git4idea.repo.GitRepository;
import git4idea.ui.GitCommitListWithDiffPanel;
@@ -78,7 +77,7 @@ public class GitBranchIsNotFullyMergedDialog extends DialogWrapper {
@NotNull List mergedToBranches,
@Nullable String baseBranch) {
GitBranchIsNotFullyMergedDialog dialog = new GitBranchIsNotFullyMergedDialog(project, commits, branchToDelete, baseBranch, mergedToBranches);
- ServiceManager.getService(project, GitPlatformFacade.class).showDialog(dialog);
+ DialogManager.show(dialog);
return dialog.isOK();
}
diff --git a/plugins/git4idea/src/git4idea/branch/GitBranchOperation.java b/plugins/git4idea/src/git4idea/branch/GitBranchOperation.java
index f43d13122400..ab843baa72e3 100644
--- a/plugins/git4idea/src/git4idea/branch/GitBranchOperation.java
+++ b/plugins/git4idea/src/git4idea/branch/GitBranchOperation.java
@@ -16,7 +16,9 @@
package git4idea.branch;
import com.intellij.dvcs.DvcsUtil;
+import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
@@ -24,6 +26,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.VcsNotifier;
import com.intellij.openapi.vcs.changes.Change;
+import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
@@ -40,6 +43,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.*;
+import static com.intellij.openapi.application.ModalityState.defaultModalityState;
import static com.intellij.openapi.util.text.StringUtil.pluralize;
/**
@@ -51,21 +55,19 @@ abstract class GitBranchOperation {
protected static final Logger LOG = Logger.getInstance(GitBranchOperation.class);
@NotNull protected final Project myProject;
- @NotNull protected final GitPlatformFacade myFacade;
@NotNull protected final Git myGit;
@NotNull protected final GitBranchUiHandler myUiHandler;
@NotNull private final Collection myRepositories;
@NotNull protected final Map myCurrentHeads;
- private final GitVcsSettings mySettings;
+ @NotNull private final GitVcsSettings mySettings;
@NotNull private final Collection mySuccessfulRepositories;
@NotNull private final Collection mySkippedRepositories;
@NotNull private final Collection myRemainingRepositories;
- protected GitBranchOperation(@NotNull Project project, @NotNull GitPlatformFacade facade, @NotNull Git git,
+ protected GitBranchOperation(@NotNull Project project, @NotNull Git git,
@NotNull GitBranchUiHandler uiHandler, @NotNull Collection repositories) {
myProject = project;
- myFacade = facade;
myGit = git;
myUiHandler = uiHandler;
myRepositories = repositories;
@@ -79,7 +81,7 @@ abstract class GitBranchOperation {
mySuccessfulRepositories = new ArrayList();
mySkippedRepositories = new ArrayList();
myRemainingRepositories = new ArrayList(myRepositories);
- mySettings = myFacade.getSettings(myProject);
+ mySettings = GitVcsSettings.getInstance(myProject);
}
protected abstract void execute();
@@ -187,7 +189,7 @@ abstract class GitBranchOperation {
}
protected final void saveAllDocuments() {
- myFacade.saveAllDocuments();
+ ApplicationManager.getApplication().invokeAndWait(() -> FileDocumentManager.getInstance().saveAllDocuments(), defaultModalityState());
}
/**
@@ -294,7 +296,7 @@ abstract class GitBranchOperation {
protected void refreshRoot(@NotNull GitRepository repository) {
// marking all files dirty, because sometimes FileWatcher is unable to process such a large set of changes that can happen during
// checkout on a large repository: IDEA-89944
- myFacade.hardRefresh(repository.getRoot());
+ VfsUtil.markDirtyAndRefresh(false, true, false, repository.getRoot());
}
protected void fatalLocalChangesError(@NotNull String reference) {
diff --git a/plugins/git4idea/src/git4idea/branch/GitBranchUiHandlerImpl.java b/plugins/git4idea/src/git4idea/branch/GitBranchUiHandlerImpl.java
index 309a3e911ac8..14cb1ebcd462 100644
--- a/plugins/git4idea/src/git4idea/branch/GitBranchUiHandlerImpl.java
+++ b/plugins/git4idea/src/git4idea/branch/GitBranchUiHandlerImpl.java
@@ -47,13 +47,11 @@ public class GitBranchUiHandlerImpl implements GitBranchUiHandler {
@NotNull private final Project myProject;
@NotNull private final Git myGit;
- @NotNull private final GitPlatformFacade myFacade;
@NotNull private final ProgressIndicator myProgressIndicator;
- public GitBranchUiHandlerImpl(@NotNull Project project, @NotNull GitPlatformFacade facade, @NotNull Git git, @NotNull ProgressIndicator indicator) {
+ public GitBranchUiHandlerImpl(@NotNull Project project, @NotNull Git git, @NotNull ProgressIndicator indicator) {
myProject = project;
myGit = git;
- myFacade = facade;
myProgressIndicator = indicator;
}
@@ -90,7 +88,7 @@ public class GitBranchUiHandlerImpl implements GitBranchUiHandler {
setMergeDescription(String.format("The following files have unresolved conflicts. You need to resolve them before %s.",
operationName)).
setErrorNotificationTitle("Unresolved files remain.");
- new GitConflictResolver(myProject, myGit, myFacade, GitUtil.getRootsFromRepositories(repositories), params).merge();
+ new GitConflictResolver(myProject, myGit, GitUtil.getRootsFromRepositories(repositories), params).merge();
}
}
}
diff --git a/plugins/git4idea/src/git4idea/branch/GitBranchWorker.java b/plugins/git4idea/src/git4idea/branch/GitBranchWorker.java
index 64e0482d3b9c..2e4eadf4523e 100644
--- a/plugins/git4idea/src/git4idea/branch/GitBranchWorker.java
+++ b/plugins/git4idea/src/git4idea/branch/GitBranchWorker.java
@@ -27,7 +27,6 @@ import com.intellij.util.containers.ContainerUtil;
import git4idea.GitCommit;
import git4idea.GitExecutionException;
import git4idea.GitLocalBranch;
-import git4idea.GitPlatformFacade;
import git4idea.changes.GitChangeUtils;
import git4idea.commands.Git;
import git4idea.history.GitHistoryUtils;
@@ -46,21 +45,17 @@ import java.util.Map;
* Executes the logic of git branch operations.
* All operations are run in the current thread.
* All UI interaction is done via the {@link GitBranchUiHandler} passed to the constructor.
- *
- * @author Kirill Likhodedov
*/
public final class GitBranchWorker {
private static final Logger LOG = Logger.getInstance(GitBranchWorker.class);
@NotNull private final Project myProject;
- @NotNull private final GitPlatformFacade myFacade;
@NotNull private final Git myGit;
@NotNull private final GitBranchUiHandler myUiHandler;
- public GitBranchWorker(@NotNull Project project, @NotNull GitPlatformFacade facade, @NotNull Git git, @NotNull GitBranchUiHandler uiHandler) {
+ public GitBranchWorker(@NotNull Project project, @NotNull Git git, @NotNull GitBranchUiHandler uiHandler) {
myProject = project;
- myFacade = facade;
myGit = git;
myUiHandler = uiHandler;
}
@@ -75,7 +70,7 @@ public final class GitBranchWorker {
}
});
if (!repositories.isEmpty()) {
- new GitCheckoutNewBranchOperation(myProject, myFacade, myGit, myUiHandler, repositories, name).execute();
+ new GitCheckoutNewBranchOperation(myProject, myGit, myUiHandler, repositories, name).execute();
}
else {
LOG.error("Creating new branch the same as current in all repositories: " + name);
@@ -92,23 +87,23 @@ public final class GitBranchWorker {
public void checkoutNewBranchStartingFrom(@NotNull String newBranchName, @NotNull String startPoint,
@NotNull List repositories) {
updateInfo(repositories);
- new GitCheckoutOperation(myProject, myFacade, myGit, myUiHandler, repositories, startPoint, false, true, newBranchName).execute();
+ new GitCheckoutOperation(myProject, myGit, myUiHandler, repositories, startPoint, false, true, newBranchName).execute();
}
public void checkout(@NotNull final String reference, boolean detach, @NotNull List repositories) {
updateInfo(repositories);
- new GitCheckoutOperation(myProject, myFacade, myGit, myUiHandler, repositories, reference, detach, false, null).execute();
+ new GitCheckoutOperation(myProject, myGit, myUiHandler, repositories, reference, detach, false, null).execute();
}
public void deleteBranch(@NotNull final String branchName, @NotNull final List repositories) {
updateInfo(repositories);
- new GitDeleteBranchOperation(myProject, myFacade, myGit, myUiHandler, repositories, branchName).execute();
+ new GitDeleteBranchOperation(myProject, myGit, myUiHandler, repositories, branchName).execute();
}
public void deleteRemoteBranch(@NotNull final String branchName, @NotNull final List repositories) {
updateInfo(repositories);
- new GitDeleteRemoteBranchOperation(myProject, myFacade, myGit, myUiHandler, repositories, branchName).execute();
+ new GitDeleteRemoteBranchOperation(myProject, myGit, myUiHandler, repositories, branchName).execute();
}
public void merge(@NotNull final String branchName, @NotNull final GitBrancher.DeleteOnMergeOption deleteOnMerge,
@@ -118,7 +113,7 @@ public final class GitBranchWorker {
for (GitRepository repository : repositories) {
revisions.put(repository, repository.getCurrentRevision());
}
- new GitMergeOperation(myProject, myFacade, myGit, myUiHandler, repositories, branchName, deleteOnMerge, revisions).execute();
+ new GitMergeOperation(myProject, myGit, myUiHandler, repositories, branchName, deleteOnMerge, revisions).execute();
}
public void rebase(@NotNull List repositories, @NotNull String branchName) {
@@ -134,7 +129,7 @@ public final class GitBranchWorker {
public void renameBranch(@NotNull String currentName, @NotNull String newName, @NotNull List repositories) {
updateInfo(repositories);
- new GitRenameBranchOperation(myProject, myFacade, myGit, myUiHandler, currentName, newName, repositories).execute();
+ new GitRenameBranchOperation(myProject, myGit, myUiHandler, currentName, newName, repositories).execute();
}
public void compare(@NotNull final String branchName, @NotNull final List repositories,
diff --git a/plugins/git4idea/src/git4idea/branch/GitBrancherImpl.java b/plugins/git4idea/src/git4idea/branch/GitBrancherImpl.java
index 3ac8293a42bf..e05cac19eacf 100644
--- a/plugins/git4idea/src/git4idea/branch/GitBrancherImpl.java
+++ b/plugins/git4idea/src/git4idea/branch/GitBrancherImpl.java
@@ -21,7 +21,6 @@ import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.Project;
import git4idea.GitVcs;
-import git4idea.GitPlatformFacade;
import git4idea.commands.Git;
import git4idea.repo.GitRepository;
import org.jetbrains.annotations.NotNull;
@@ -36,12 +35,10 @@ class GitBrancherImpl implements GitBrancher {
@NotNull private final Project myProject;
- @NotNull private final GitPlatformFacade myFacade;
@NotNull private final Git myGit;
- GitBrancherImpl(@NotNull Project project, @NotNull GitPlatformFacade facade, @NotNull Git git) {
+ GitBrancherImpl(@NotNull Project project, @NotNull Git git) {
myProject = project;
- myFacade = facade;
myGit = git;
}
@@ -55,7 +52,7 @@ class GitBrancherImpl implements GitBrancher {
}
private GitBranchWorker newWorker(ProgressIndicator indicator) {
- return new GitBranchWorker(myProject, myFacade, myGit, new GitBranchUiHandlerImpl(myProject, myFacade, myGit, indicator));
+ return new GitBranchWorker(myProject, myGit, new GitBranchUiHandlerImpl(myProject, myGit, indicator));
}
@Override
diff --git a/plugins/git4idea/src/git4idea/branch/GitCheckoutNewBranchOperation.java b/plugins/git4idea/src/git4idea/branch/GitCheckoutNewBranchOperation.java
index 397ddf3e9b77..59144434d074 100644
--- a/plugins/git4idea/src/git4idea/branch/GitCheckoutNewBranchOperation.java
+++ b/plugins/git4idea/src/git4idea/branch/GitCheckoutNewBranchOperation.java
@@ -18,7 +18,6 @@ package git4idea.branch;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.VcsNotifier;
-import git4idea.GitPlatformFacade;
import git4idea.commands.Git;
import git4idea.commands.GitCommandResult;
import git4idea.commands.GitCompoundResult;
@@ -38,9 +37,9 @@ class GitCheckoutNewBranchOperation extends GitBranchOperation {
@NotNull private final Project myProject;
@NotNull private final String myNewBranchName;
- GitCheckoutNewBranchOperation(@NotNull Project project, GitPlatformFacade facade, @NotNull Git git, @NotNull GitBranchUiHandler uiHandler,
+ GitCheckoutNewBranchOperation(@NotNull Project project, @NotNull Git git, @NotNull GitBranchUiHandler uiHandler,
@NotNull Collection repositories, @NotNull String newBranchName) {
- super(project, facade, git, uiHandler, repositories);
+ super(project, git, uiHandler, repositories);
myNewBranchName = newBranchName;
myProject = project;
}
diff --git a/plugins/git4idea/src/git4idea/branch/GitCheckoutOperation.java b/plugins/git4idea/src/git4idea/branch/GitCheckoutOperation.java
index 9cf1995cb5e0..46cd668d83a6 100644
--- a/plugins/git4idea/src/git4idea/branch/GitCheckoutOperation.java
+++ b/plugins/git4idea/src/git4idea/branch/GitCheckoutOperation.java
@@ -26,7 +26,6 @@ import com.intellij.openapi.vcs.VcsNotifier;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ArrayUtil;
-import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
import git4idea.commands.*;
import git4idea.config.GitVcsSettings;
@@ -61,7 +60,6 @@ class GitCheckoutOperation extends GitBranchOperation {
@Nullable private final String myNewBranch;
GitCheckoutOperation(@NotNull Project project,
- GitPlatformFacade facade,
@NotNull Git git,
@NotNull GitBranchUiHandler uiHandler,
@NotNull Collection repositories,
@@ -69,7 +67,7 @@ class GitCheckoutOperation extends GitBranchOperation {
boolean detach,
boolean refShouldBeValid,
@Nullable String newBranch) {
- super(project, facade, git, uiHandler, repositories);
+ super(project, git, uiHandler, repositories);
myStartPointReference = startPointReference;
myDetach = detach;
myRefShouldBeValid = refShouldBeValid;
@@ -253,7 +251,7 @@ class GitCheckoutOperation extends GitBranchOperation {
private boolean smartCheckout(@NotNull final List repositories, @NotNull final String reference,
@Nullable final String newBranch, @NotNull ProgressIndicator indicator) {
final AtomicBoolean result = new AtomicBoolean();
- GitPreservingProcess preservingProcess = new GitPreservingProcess(myProject, myFacade, myGit,
+ GitPreservingProcess preservingProcess = new GitPreservingProcess(myProject, myGit,
GitUtil.getRootsFromRepositories(repositories), "checkout", reference,
GitVcsSettings.UpdateChangesPolicy.STASH, indicator,
new Runnable() {
diff --git a/plugins/git4idea/src/git4idea/branch/GitDeleteBranchOperation.java b/plugins/git4idea/src/git4idea/branch/GitDeleteBranchOperation.java
index 1dba1e07f6ac..b7ea81dfb061 100644
--- a/plugins/git4idea/src/git4idea/branch/GitDeleteBranchOperation.java
+++ b/plugins/git4idea/src/git4idea/branch/GitDeleteBranchOperation.java
@@ -22,7 +22,6 @@ import com.intellij.openapi.vcs.VcsNotifier;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtil;
import git4idea.GitCommit;
-import git4idea.GitPlatformFacade;
import git4idea.commands.*;
import git4idea.repo.GitRepository;
import org.jetbrains.annotations.NotNull;
@@ -36,8 +35,6 @@ import java.util.regex.Pattern;
* Deletes a branch.
* If branch is not fully merged to the current branch, shows a dialog with the list of unmerged commits and with a list of branches
* current branch are merged to, and makes force delete, if wanted.
- *
- * @author Kirill Likhodedov
*/
class GitDeleteBranchOperation extends GitBranchOperation {
@@ -45,9 +42,9 @@ class GitDeleteBranchOperation extends GitBranchOperation {
private final String myBranchName;
- GitDeleteBranchOperation(@NotNull Project project, GitPlatformFacade facade, @NotNull Git git, @NotNull GitBranchUiHandler uiHandler,
+ GitDeleteBranchOperation(@NotNull Project project, @NotNull Git git, @NotNull GitBranchUiHandler uiHandler,
@NotNull Collection repositories, @NotNull String branchName) {
- super(project, facade, git, uiHandler, repositories);
+ super(project, git, uiHandler, repositories);
myBranchName = branchName;
}
diff --git a/plugins/git4idea/src/git4idea/branch/GitDeleteRemoteBranchOperation.java b/plugins/git4idea/src/git4idea/branch/GitDeleteRemoteBranchOperation.java
index 82b7580cd6fa..f25d6aee15b5 100644
--- a/plugins/git4idea/src/git4idea/branch/GitDeleteRemoteBranchOperation.java
+++ b/plugins/git4idea/src/git4idea/branch/GitDeleteRemoteBranchOperation.java
@@ -23,7 +23,6 @@ import com.intellij.openapi.util.Couple;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.VcsNotifier;
import com.intellij.util.ui.UIUtil;
-import git4idea.GitPlatformFacade;
import git4idea.commands.Git;
import git4idea.commands.GitCommandResult;
import git4idea.commands.GitCompoundResult;
@@ -42,10 +41,10 @@ import java.util.concurrent.atomic.AtomicReference;
class GitDeleteRemoteBranchOperation extends GitBranchOperation {
private final String myBranchName;
- public GitDeleteRemoteBranchOperation(@NotNull Project project, @NotNull GitPlatformFacade facade, @NotNull Git git,
+ public GitDeleteRemoteBranchOperation(@NotNull Project project, @NotNull Git git,
@NotNull GitBranchUiHandler handler, @NotNull List repositories,
@NotNull String name) {
- super(project, facade, git, handler, repositories);
+ super(project, git, handler, repositories);
myBranchName = name;
}
@@ -77,7 +76,7 @@ class GitDeleteRemoteBranchOperation extends GitBranchOperation {
if (decision.get().deleteTracking()) {
for (final String branch : trackingBranches) {
getIndicator().setText("Deleting " + branch);
- new GitDeleteBranchOperation(myProject, myFacade, myGit, myUiHandler, repositories, branch) {
+ new GitDeleteBranchOperation(myProject, myGit, myUiHandler, repositories, branch) {
@Override
protected void notifySuccess(@NotNull String message) {
// do nothing - will display a combo notification for all deleted branches below
diff --git a/plugins/git4idea/src/git4idea/branch/GitMergeOperation.java b/plugins/git4idea/src/git4idea/branch/GitMergeOperation.java
index fad235ea4ca9..19eb1517e1f5 100644
--- a/plugins/git4idea/src/git4idea/branch/GitMergeOperation.java
+++ b/plugins/git4idea/src/git4idea/branch/GitMergeOperation.java
@@ -29,7 +29,6 @@ import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.ChangeListManager;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ui.UIUtil;
-import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
import git4idea.commands.*;
import git4idea.config.GitVcsSettings;
@@ -58,15 +57,15 @@ class GitMergeOperation extends GitBranchOperation {
@NotNull private final Map myConflictedRepositories = new HashMap();
private GitPreservingProcess myPreservingProcess;
- GitMergeOperation(@NotNull Project project, GitPlatformFacade facade, @NotNull Git git, @NotNull GitBranchUiHandler uiHandler,
+ GitMergeOperation(@NotNull Project project, @NotNull Git git, @NotNull GitBranchUiHandler uiHandler,
@NotNull Collection repositories,
@NotNull String branchToMerge, GitBrancher.DeleteOnMergeOption deleteOnMerge,
@NotNull Map currentRevisionsBeforeMerge) {
- super(project, facade, git, uiHandler, repositories);
+ super(project, git, uiHandler, repositories);
myBranchToMerge = branchToMerge;
myDeleteOnMerge = deleteOnMerge;
myCurrentRevisionsBeforeMerge = currentRevisionsBeforeMerge;
- myChangeListManager = myFacade.getChangeListManager(myProject);
+ myChangeListManager = ChangeListManager.getInstance(myProject);
}
@Override
@@ -216,9 +215,9 @@ class GitMergeOperation extends GitBranchOperation {
private boolean doSmartMerge(@NotNull final Collection repositories) {
final AtomicBoolean success = new AtomicBoolean();
- myPreservingProcess = new GitPreservingProcess(myProject, myFacade, myGit, GitUtil.getRootsFromRepositories(repositories), "merge",
+ myPreservingProcess = new GitPreservingProcess(myProject, myGit, GitUtil.getRootsFromRepositories(repositories), "merge",
myBranchToMerge, GitVcsSettings.UpdateChangesPolicy.STASH, getIndicator(),
- new Runnable() {
+ new Runnable() {
@Override
public void run() {
success.set(doMerge(repositories));
@@ -312,10 +311,10 @@ class GitMergeOperation extends GitBranchOperation {
LOG.info("Starting smart rollback...");
final GitCompoundResult result = new GitCompoundResult(myProject);
Collection roots = GitUtil.getRootsFromRepositories(repositories);
- GitPreservingProcess preservingProcess = new GitPreservingProcess(myProject, myFacade, myGit, roots, "merge",
+ GitPreservingProcess preservingProcess = new GitPreservingProcess(myProject, myGit, roots, "merge",
myBranchToMerge, GitVcsSettings.UpdateChangesPolicy.STASH,
getIndicator(),
- new Runnable() {
+ new Runnable() {
@Override public void run() {
for (GitRepository repository : repositories) {
result.append(repository, rollback(repository));
diff --git a/plugins/git4idea/src/git4idea/branch/GitRenameBranchOperation.java b/plugins/git4idea/src/git4idea/branch/GitRenameBranchOperation.java
index 0faf227f760f..749ac1c4b9d2 100644
--- a/plugins/git4idea/src/git4idea/branch/GitRenameBranchOperation.java
+++ b/plugins/git4idea/src/git4idea/branch/GitRenameBranchOperation.java
@@ -33,13 +33,12 @@ public class GitRenameBranchOperation extends GitBranchOperation {
@NotNull private final String myNewName;
public GitRenameBranchOperation(@NotNull Project project,
- @NotNull GitPlatformFacade facade,
@NotNull Git git,
@NotNull GitBranchUiHandler uiHandler,
@NotNull String currentName,
@NotNull String newName,
@NotNull List repositories) {
- super(project, facade, git, uiHandler, repositories);
+ super(project, git, uiHandler, repositories);
myCurrentName = currentName;
myNewName = newName;
myNotifier = VcsNotifier.getInstance(myProject);
diff --git a/plugins/git4idea/src/git4idea/branch/GitSmartOperationDialog.java b/plugins/git4idea/src/git4idea/branch/GitSmartOperationDialog.java
index 4f5073027624..3978cc89e8e4 100644
--- a/plugins/git4idea/src/git4idea/branch/GitSmartOperationDialog.java
+++ b/plugins/git4idea/src/git4idea/branch/GitSmartOperationDialog.java
@@ -16,13 +16,12 @@
package git4idea.branch;
import com.intellij.openapi.application.ApplicationNamesInfo;
-import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.components.JBLabel;
import com.intellij.util.ui.UIUtil;
-import git4idea.GitPlatformFacade;
+import git4idea.DialogManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -57,7 +56,7 @@ public class GitSmartOperationDialog extends DialogWrapper {
@Override
public void run() {
GitSmartOperationDialog dialog = new GitSmartOperationDialog(project, fileBrowser, operationTitle, forceButtonTitle);
- ServiceManager.getService(project, GitPlatformFacade.class).showDialog(dialog);
+ DialogManager.show(dialog);
exitCode.set(dialog.getExitCode());
}
});
diff --git a/plugins/git4idea/src/git4idea/checkin/GitCheckinHandlerFactory.java b/plugins/git4idea/src/git4idea/checkin/GitCheckinHandlerFactory.java
index 281dcb117247..a9483bfb2667 100644
--- a/plugins/git4idea/src/git4idea/checkin/GitCheckinHandlerFactory.java
+++ b/plugins/git4idea/src/git4idea/checkin/GitCheckinHandlerFactory.java
@@ -42,7 +42,6 @@ import com.intellij.util.PairConsumer;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import com.intellij.xml.util.XmlStringUtil;
-import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
import git4idea.GitVcs;
import git4idea.commands.Git;
@@ -118,7 +117,6 @@ public class GitCheckinHandlerFactory extends VcsCheckinHandlerFactory {
return ReturnResult.COMMIT;
}
- final GitPlatformFacade platformFacade = ServiceManager.getService(myProject, GitPlatformFacade.class);
final Git git = ServiceManager.getService(Git.class);
final Collection files = myPanel.getVirtualFiles(); // deleted files aren't included, but for them we don't care about CRLFs.
@@ -128,7 +126,7 @@ public class GitCheckinHandlerFactory extends VcsCheckinHandlerFactory {
@Override
public void run(@NotNull ProgressIndicator indicator) {
crlfHelper.set(GitCrlfProblemsDetector.detect(GitCheckinHandlerFactory.MyCheckinHandler.this.myProject,
- platformFacade, git, files));
+ git, files));
}
});
diff --git a/plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java b/plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java
index 5a4f9597dec1..3b8cc082c2bf 100644
--- a/plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java
+++ b/plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java
@@ -20,11 +20,13 @@ import com.intellij.dvcs.cherrypick.VcsCherryPicker;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationListener;
import com.intellij.openapi.application.AccessToken;
+import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vcs.AbstractVcsHelper;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.VcsKey;
import com.intellij.openapi.vcs.VcsNotifier;
@@ -32,6 +34,7 @@ import com.intellij.openapi.vcs.changes.*;
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
import com.intellij.openapi.vcs.merge.MergeDialogCustomizer;
import com.intellij.openapi.vcs.update.RefreshVFsSynchronously;
+import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Consumer;
import com.intellij.util.Function;
@@ -41,7 +44,7 @@ import com.intellij.vcs.log.VcsFullCommitDetails;
import com.intellij.vcs.log.VcsLog;
import com.intellij.vcs.log.util.VcsUserUtil;
import git4idea.GitLocalBranch;
-import git4idea.GitPlatformFacade;
+import git4idea.GitUtil;
import git4idea.GitVcs;
import git4idea.commands.Git;
import git4idea.commands.GitCommandResult;
@@ -50,6 +53,7 @@ import git4idea.commands.GitUntrackedFilesOverwrittenByOperationDetector;
import git4idea.config.GitVcsSettings;
import git4idea.merge.GitConflictResolver;
import git4idea.repo.GitRepository;
+import git4idea.repo.GitRepositoryManager;
import git4idea.util.GitUntrackedFilesHelper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -78,19 +82,18 @@ public class GitCherryPicker extends VcsCherryPicker {
@NotNull private final Project myProject;
@NotNull private final Git myGit;
- @NotNull private final GitPlatformFacade myPlatformFacade;
@NotNull private final ChangeListManager myChangeListManager;
+ @NotNull private final GitRepositoryManager myRepositoryManager;
- public GitCherryPicker(@NotNull Project project, @NotNull Git git, @NotNull GitPlatformFacade platformFacade) {
+ public GitCherryPicker(@NotNull Project project, @NotNull Git git) {
myProject = project;
myGit = git;
- myPlatformFacade = platformFacade;
- myChangeListManager = myPlatformFacade.getChangeListManager(myProject);
+ myChangeListManager = ChangeListManager.getInstance(myProject);
+ myRepositoryManager = GitUtil.getRepositoryManager(myProject);
}
public void cherryPick(@NotNull List commits) {
- Map> commitsInRoots =
- DvcsUtil.groupCommitsByRoots(myPlatformFacade.getRepositoryManager(myProject), commits);
+ Map> commitsInRoots = DvcsUtil.groupCommitsByRoots(myRepositoryManager, commits);
LOG.info("Cherry-picking commits: " + toString(commitsInRoots));
List successfulCommits = ContainerUtil.newArrayList();
List alreadyPicked = ContainerUtil.newArrayList();
@@ -153,7 +156,7 @@ public class GitCherryPicker extends VcsCherryPicker {
}
}
else if (conflictDetector.hasHappened()) {
- boolean mergeCompleted = new CherryPickConflictResolver(myProject, myGit, myPlatformFacade, repository.getRoot(),
+ boolean mergeCompleted = new CherryPickConflictResolver(myProject, myGit, repository.getRoot(),
commit.getId().asString(), VcsUserUtil.getShortPresentation(commit.getAuthor()),
commit.getSubject()).merge();
@@ -226,7 +229,7 @@ public class GitCherryPicker extends VcsCherryPicker {
private void notifyConflictWarning(@NotNull GitRepository repository, @NotNull GitCommitWrapper commit,
@NotNull List successfulCommits) {
- NotificationListener resolveLinkListener = new ResolveLinkListener(myProject, myGit, myPlatformFacade, repository.getRoot(),
+ NotificationListener resolveLinkListener = new ResolveLinkListener(myProject, myGit, repository.getRoot(),
commit.getCommit().getId().toShortString(),
VcsUserUtil.getShortPresentation(commit.getCommit().getAuthor()),
commit.getSubject());
@@ -261,7 +264,7 @@ public class GitCherryPicker extends VcsCherryPicker {
@NotNull final String commitMessage) {
final CountDownLatch waiter = new CountDownLatch(1);
final AtomicReference changeList = new AtomicReference();
- myPlatformFacade.invokeAndWait(new Runnable() {
+ ApplicationManager.getApplication().invokeAndWait(new Runnable() {
@Override
public void run() {
myChangeListManager.invokeAfterUpdate(new Runnable() {
@@ -300,13 +303,13 @@ public class GitCherryPicker extends VcsCherryPicker {
@NotNull final LocalChangeList changeList, @NotNull final String commitMessage) {
final AtomicBoolean commitSucceeded = new AtomicBoolean();
final Semaphore sem = new Semaphore(0);
- myPlatformFacade.invokeAndWait(new Runnable() {
+ ApplicationManager.getApplication().invokeAndWait(new Runnable() {
@Override
public void run() {
try {
cancelCherryPick(repository);
Collection changes = commit.getCommit().getChanges();
- boolean commitNotCancelled = myPlatformFacade.getVcsHelper(myProject).commitChanges(changes, changeList, commitMessage,
+ boolean commitNotCancelled = AbstractVcsHelper.getInstance(myProject).commitChanges(changes, changeList, commitMessage,
new CommitResultHandler() {
@Override
public void onSuccess(@NotNull String commitMessage) {
@@ -357,10 +360,10 @@ public class GitCherryPicker extends VcsCherryPicker {
private void removeCherryPickHead(@NotNull GitRepository repository) {
File cherryPickHeadFile = repository.getRepositoryFiles().getCherryPickHead();
- final VirtualFile cherryPickHead = myPlatformFacade.getLocalFileSystem().refreshAndFindFileByIoFile(cherryPickHeadFile);
+ final VirtualFile cherryPickHead = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(cherryPickHeadFile);
if (cherryPickHead != null && cherryPickHead.exists()) {
- myPlatformFacade.runWriteAction(new Runnable() {
+ ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
try {
@@ -548,7 +551,7 @@ public class GitCherryPicker extends VcsCherryPicker {
}
for (VirtualFile root : commits.keySet()) {
- GitRepository repository = myPlatformFacade.getRepositoryManager(myProject).getRepositoryForRoot(root);
+ GitRepository repository = myRepositoryManager.getRepositoryForRoot(root);
if (repository == null) {
return false;
}
@@ -576,9 +579,13 @@ public class GitCherryPicker extends VcsCherryPicker {
private static class CherryPickConflictResolver extends GitConflictResolver {
- public CherryPickConflictResolver(@NotNull Project project, @NotNull Git git, @NotNull GitPlatformFacade facade, @NotNull VirtualFile root,
- @NotNull String commitHash, @NotNull String commitAuthor, @NotNull String commitMessage) {
- super(project, git, facade, Collections.singleton(root), makeParams(commitHash, commitAuthor, commitMessage));
+ public CherryPickConflictResolver(@NotNull Project project,
+ @NotNull Git git,
+ @NotNull VirtualFile root,
+ @NotNull String commitHash,
+ @NotNull String commitAuthor,
+ @NotNull String commitMessage) {
+ super(project, git, Collections.singleton(root), makeParams(commitHash, commitAuthor, commitMessage));
}
private static Params makeParams(String commitHash, String commitAuthor, String commitMessage) {
@@ -598,18 +605,16 @@ public class GitCherryPicker extends VcsCherryPicker {
private static class ResolveLinkListener implements NotificationListener {
@NotNull private final Project myProject;
@NotNull private final Git myGit;
- @NotNull private final GitPlatformFacade myFacade;
@NotNull private final VirtualFile myRoot;
@NotNull private final String myHash;
@NotNull private final String myAuthor;
@NotNull private final String myMessage;
- public ResolveLinkListener(@NotNull Project project, @NotNull Git git, @NotNull GitPlatformFacade facade, @NotNull VirtualFile root,
+ public ResolveLinkListener(@NotNull Project project, @NotNull Git git, @NotNull VirtualFile root,
@NotNull String commitHash, @NotNull String commitAuthor, @NotNull String commitMessage) {
myProject = project;
myGit = git;
- myFacade = facade;
myRoot = root;
myHash = commitHash;
myAuthor = commitAuthor;
@@ -621,7 +626,7 @@ public class GitCherryPicker extends VcsCherryPicker {
@NotNull HyperlinkEvent event) {
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
if (event.getDescription().equals("resolve")) {
- new CherryPickConflictResolver(myProject, myGit, myFacade, myRoot, myHash, myAuthor, myMessage).mergeNoProceed();
+ new CherryPickConflictResolver(myProject, myGit, myRoot, myHash, myAuthor, myMessage).mergeNoProceed();
}
}
}
diff --git a/plugins/git4idea/src/git4idea/crlf/GitCrlfProblemsDetector.java b/plugins/git4idea/src/git4idea/crlf/GitCrlfProblemsDetector.java
index 68bb3a11578f..8568ad027bbf 100644
--- a/plugins/git4idea/src/git4idea/crlf/GitCrlfProblemsDetector.java
+++ b/plugins/git4idea/src/git4idea/crlf/GitCrlfProblemsDetector.java
@@ -16,11 +16,11 @@
package git4idea.crlf;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
import com.intellij.openapi.progress.ProgressIndicatorProvider;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile;
-import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
import git4idea.attributes.GitAttribute;
import git4idea.attributes.GitCheckAttrParser;
@@ -28,6 +28,7 @@ import git4idea.commands.Git;
import git4idea.commands.GitCommandResult;
import git4idea.config.GitConfigUtil;
import git4idea.repo.GitRepository;
+import git4idea.repo.GitRepositoryManager;
import org.jetbrains.annotations.NotNull;
import java.util.*;
@@ -55,21 +56,20 @@ public class GitCrlfProblemsDetector {
private static final String CRLF = "\r\n";
@NotNull private final Project myProject;
- @NotNull private final GitPlatformFacade myPlatformFacade;
@NotNull private final Git myGit;
+ @NotNull private final GitRepositoryManager myRepositoryManager;
private final boolean myShouldWarn;
@NotNull
- public static GitCrlfProblemsDetector detect(@NotNull Project project, @NotNull GitPlatformFacade platformFacade,
- @NotNull Git git, @NotNull Collection files) {
- return new GitCrlfProblemsDetector(project, platformFacade, git, files);
+ public static GitCrlfProblemsDetector detect(@NotNull Project project, @NotNull Git git, @NotNull Collection files) {
+ return new GitCrlfProblemsDetector(project, git, files);
}
- private GitCrlfProblemsDetector(@NotNull Project project, @NotNull GitPlatformFacade platformFacade, @NotNull Git git,
+ private GitCrlfProblemsDetector(@NotNull Project project, @NotNull Git git,
@NotNull Collection files) {
myProject = project;
- myPlatformFacade = platformFacade;
+ myRepositoryManager = GitUtil.getRepositoryManager(project);
myGit = git;
Map> filesByRoots = sortFilesByRoots(files);
@@ -101,7 +101,7 @@ public class GitCrlfProblemsDetector {
@NotNull
private Collection findFilesWithoutAttrs(@NotNull VirtualFile root, @NotNull Collection files) {
- GitRepository repository = myPlatformFacade.getRepositoryManager(myProject).getRepositoryForRoot(root);
+ GitRepository repository = myRepositoryManager.getRepositoryForRoot(root);
if (repository == null) {
LOG.warn("Repository is null for " + root);
return Collections.emptyList();
@@ -148,7 +148,7 @@ public class GitCrlfProblemsDetector {
Collection filesWithCrlf = new ArrayList();
for (VirtualFile file : files) {
ProgressIndicatorProvider.checkCanceled();
- String separator = myPlatformFacade.getLineSeparator(file, true);
+ String separator = LoadTextUtil.detectLineSeparator(file, true);
if (CRLF.equals(separator)) {
filesWithCrlf.add(file);
}
@@ -170,7 +170,7 @@ public class GitCrlfProblemsDetector {
}
private boolean isAutoCrlfSetRight(@NotNull VirtualFile root) {
- GitRepository repository = myPlatformFacade.getRepositoryManager(myProject).getRepositoryForRoot(root);
+ GitRepository repository = myRepositoryManager.getRepositoryForRoot(root);
if (repository == null) {
LOG.warn("Repository is null for " + root);
return true;
diff --git a/plugins/git4idea/src/git4idea/log/GitShowExternalLogAction.java b/plugins/git4idea/src/git4idea/log/GitShowExternalLogAction.java
index 2b0e516bbacb..16deabacab91 100644
--- a/plugins/git4idea/src/git4idea/log/GitShowExternalLogAction.java
+++ b/plugins/git4idea/src/git4idea/log/GitShowExternalLogAction.java
@@ -47,7 +47,6 @@ import com.intellij.util.containers.ContainerUtil;
import com.intellij.vcs.log.data.VcsLogTabsProperties;
import com.intellij.vcs.log.impl.VcsLogContentProvider;
import com.intellij.vcs.log.impl.VcsLogManager;
-import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
import git4idea.GitVcs;
import git4idea.config.GitVersion;
@@ -125,7 +124,6 @@ public class GitShowExternalLogAction extends DumbAwareAction {
@NotNull final List roots,
@Nullable String tabName) {
final GitRepositoryManager repositoryManager = ServiceManager.getService(project, GitRepositoryManager.class);
- GitPlatformFacade facade = ServiceManager.getService(GitPlatformFacade.class);
for (VirtualFile root : roots) {
repositoryManager.addExternalRepository(root, GitRepositoryImpl.getInstance(root, project, true));
}
diff --git a/plugins/git4idea/src/git4idea/merge/GitConflictResolver.java b/plugins/git4idea/src/git4idea/merge/GitConflictResolver.java
index e95b49686778..df2a9b6c6709 100644
--- a/plugins/git4idea/src/git4idea/merge/GitConflictResolver.java
+++ b/plugins/git4idea/src/git4idea/merge/GitConflictResolver.java
@@ -47,24 +47,23 @@ import java.util.*;
import static com.intellij.dvcs.DvcsUtil.findVirtualFilesWithRefresh;
import static com.intellij.dvcs.DvcsUtil.sortVirtualFilesByPresentation;
+import static com.intellij.util.ObjectUtils.assertNotNull;
/**
- *
* The class is highly customizable, since the procedure of resolving conflicts is very common in Git operations.
- * @author Kirill Likhodedov
*/
public class GitConflictResolver {
private static final Logger LOG = Logger.getInstance(GitConflictResolver.class);
+ @NotNull private final Collection myRoots;
+ @NotNull private final Params myParams;
+
@NotNull protected final Project myProject;
@NotNull private final Git myGit;
- @NotNull private final GitPlatformFacade myPlatformFacade;
- private final Collection myRoots;
- private final Params myParams;
-
@NotNull private final GitRepositoryManager myRepositoryManager;
- private final AbstractVcsHelper myVcsHelper;
+ @NotNull private final AbstractVcsHelper myVcsHelper;
+ @NotNull private final GitVcs myVcs;
/**
* Customizing parameters - mostly String notification texts, etc.
@@ -110,15 +109,24 @@ public class GitConflictResolver {
}
- public GitConflictResolver(@NotNull Project project, @NotNull Git git, @NotNull GitPlatformFacade platformFacade,
+ /**
+ * @deprecated To remove in IDEA 2017. Use {@link #GitConflictResolver(Project, Git, Collection, Params)}.
+ */
+ @SuppressWarnings("UnusedParameters")
+ @Deprecated
+ public GitConflictResolver(@NotNull Project project, @NotNull Git git, @NotNull GitPlatformFacade facade,
@NotNull Collection roots, @NotNull Params params) {
+ this(project, git, roots, params);
+ }
+
+ public GitConflictResolver(@NotNull Project project, @NotNull Git git, @NotNull Collection roots, @NotNull Params params) {
myProject = project;
myGit = git;
- myPlatformFacade = platformFacade;
myRoots = roots;
myParams = params;
- myRepositoryManager = myPlatformFacade.getRepositoryManager(myProject);
- myVcsHelper = myPlatformFacade.getVcsHelper(project);
+ myRepositoryManager = GitUtil.getRepositoryManager(myProject);
+ myVcsHelper = AbstractVcsHelper.getInstance(project);
+ myVcs = assertNotNull(GitVcs.getInstance(myProject));
}
/**
@@ -215,7 +223,7 @@ public class GitConflictResolver {
}
}
} catch (VcsException e) {
- if (((GitVcs)myPlatformFacade.getVcs(myProject)).getExecutableValidator().checkExecutableAndNotifyIfNeeded()) {
+ if (myVcs.getExecutableValidator().checkExecutableAndNotifyIfNeeded()) {
notifyException(e);
}
}
diff --git a/plugins/git4idea/src/git4idea/merge/GitMergeCommittingConflictResolver.java b/plugins/git4idea/src/git4idea/merge/GitMergeCommittingConflictResolver.java
index 302c889ac16f..788f94d7f093 100644
--- a/plugins/git4idea/src/git4idea/merge/GitMergeCommittingConflictResolver.java
+++ b/plugins/git4idea/src/git4idea/merge/GitMergeCommittingConflictResolver.java
@@ -15,11 +15,9 @@
*/
package git4idea.merge;
-import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vfs.VirtualFile;
-import git4idea.GitPlatformFacade;
import git4idea.commands.Git;
import org.jetbrains.annotations.NotNull;
@@ -37,7 +35,7 @@ public class GitMergeCommittingConflictResolver extends GitConflictResolver {
public GitMergeCommittingConflictResolver(Project project, @NotNull Git git, GitMerger merger, Collection mergingRoots,
Params params, boolean refreshAfterCommit) {
- super(project, git, ServiceManager.getService(GitPlatformFacade.class), mergingRoots, params);
+ super(project, git, mergingRoots, params);
myMerger = merger;
myMergingRoots = mergingRoots;
myRefreshAfterCommit = refreshAfterCommit;
diff --git a/plugins/git4idea/src/git4idea/push/GitPushOperation.java b/plugins/git4idea/src/git4idea/push/GitPushOperation.java
index eff449da6f58..9dca5a727ed1 100644
--- a/plugins/git4idea/src/git4idea/push/GitPushOperation.java
+++ b/plugins/git4idea/src/git4idea/push/GitPushOperation.java
@@ -80,7 +80,6 @@ public class GitPushOperation {
private final Git myGit;
private final ProgressIndicator myProgressIndicator;
private final GitVcsSettings mySettings;
- private final GitPlatformFacade myPlatformFacade;
private final GitRepositoryManager myRepositoryManager;
public GitPushOperation(@NotNull Project project,
@@ -96,7 +95,6 @@ public class GitPushOperation {
myGit = ServiceManager.getService(Git.class);
myProgressIndicator = ObjectUtils.notNull(ProgressManager.getInstance().getProgressIndicator(), new EmptyProgressIndicator());
mySettings = GitVcsSettings.getInstance(myProject);
- myPlatformFacade = ServiceManager.getService(project, GitPlatformFacade.class);
myRepositoryManager = ServiceManager.getService(myProject, GitRepositoryManager.class);
Map currentHeads = ContainerUtil.newHashMap();
@@ -437,7 +435,7 @@ public class GitPushOperation {
protected GitUpdateResult update(@NotNull Collection rootsToUpdate,
@NotNull UpdateMethod updateMethod,
boolean checkForRebaseOverMergeProblem) {
- GitUpdateResult updateResult = new GitUpdateProcess(myProject, myPlatformFacade, myProgressIndicator,
+ GitUpdateResult updateResult = new GitUpdateProcess(myProject, myProgressIndicator,
new HashSet(rootsToUpdate), UpdatedFiles.create(),
checkForRebaseOverMergeProblem).update(updateMethod);
for (GitRepository repository : rootsToUpdate) {
diff --git a/plugins/git4idea/src/git4idea/rebase/GitAbortRebaseProcess.java b/plugins/git4idea/src/git4idea/rebase/GitAbortRebaseProcess.java
index 958ef07298ef..492aefe546bc 100644
--- a/plugins/git4idea/src/git4idea/rebase/GitAbortRebaseProcess.java
+++ b/plugins/git4idea/src/git4idea/rebase/GitAbortRebaseProcess.java
@@ -28,7 +28,6 @@ import com.intellij.openapi.util.Ref;
import com.intellij.openapi.vcs.VcsNotifier;
import com.intellij.util.containers.ContainerUtil;
import git4idea.DialogManager;
-import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
import git4idea.commands.Git;
import git4idea.commands.GitCommandResult;
@@ -146,7 +145,7 @@ class GitAbortRebaseProcess {
}
private void doAbort(final boolean rollback) {
- new GitFreezingProcess(myProject, ServiceManager.getService(GitPlatformFacade.class), "rebase", new Runnable() {
+ new GitFreezingProcess(myProject, "rebase", new Runnable() {
public void run() {
AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
List repositoriesToRefresh = ContainerUtil.newArrayList();
diff --git a/plugins/git4idea/src/git4idea/rebase/GitRebaseProcess.java b/plugins/git4idea/src/git4idea/rebase/GitRebaseProcess.java
index 0af72afff74f..adb373b302ca 100644
--- a/plugins/git4idea/src/git4idea/rebase/GitRebaseProcess.java
+++ b/plugins/git4idea/src/git4idea/rebase/GitRebaseProcess.java
@@ -38,7 +38,6 @@ import com.intellij.util.ExceptionUtil;
import com.intellij.util.Function;
import com.intellij.util.ThreeState;
import com.intellij.util.containers.MultiMap;
-import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
import git4idea.branch.GitRebaseParams;
import git4idea.commands.Git;
@@ -81,7 +80,6 @@ public class GitRebaseProcess {
@NotNull private final Git myGit;
@NotNull private final ChangeListManager myChangeListManager;
@NotNull private final VcsNotifier myNotifier;
- @NotNull private final GitPlatformFacade myFacade;
@NotNull private final GitRepositoryManager myRepositoryManager;
@NotNull private final GitRebaseSpec myRebaseSpec;
@@ -98,13 +96,12 @@ public class GitRebaseProcess {
myGit = ServiceManager.getService(Git.class);
myChangeListManager = ChangeListManager.getInstance(myProject);
myNotifier = VcsNotifier.getInstance(myProject);
- myFacade = ServiceManager.getService(GitPlatformFacade.class);
myRepositoryManager = GitUtil.getRepositoryManager(myProject);
myProgressManager = ProgressManager.getInstance();
}
public void rebase() {
- new GitFreezingProcess(myProject, myFacade, "rebase", new Runnable() {
+ new GitFreezingProcess(myProject, "rebase", new Runnable() {
public void run() {
doRebase();
}
@@ -400,8 +397,7 @@ public class GitRebaseProcess {
@NotNull
private ResolveConflictResult showConflictResolver(@NotNull GitRepository conflicting, boolean calledFromNotification) {
GitConflictResolver.Params params = new GitConflictResolver.Params().setReverse(true);
- RebaseConflictResolver conflictResolver = new RebaseConflictResolver(myProject, myGit, myFacade, conflicting, params,
- calledFromNotification);
+ RebaseConflictResolver conflictResolver = new RebaseConflictResolver(myProject, myGit, conflicting, params, calledFromNotification);
boolean allResolved = conflictResolver.merge();
if (conflictResolver.myWasNothingToMerge) return ResolveConflictResult.NOTHING_TO_MERGE;
if (allResolved) return ResolveConflictResult.ALL_RESOLVED;
@@ -494,10 +490,9 @@ public class GitRebaseProcess {
RebaseConflictResolver(@NotNull Project project,
@NotNull Git git,
- @NotNull GitPlatformFacade platformFacade,
@NotNull GitRepository repository,
@NotNull Params params, boolean calledFromNotification) {
- super(project, git, platformFacade, singleton(repository.getRoot()), params);
+ super(project, git, singleton(repository.getRoot()), params);
myCalledFromNotification = calledFromNotification;
}
diff --git a/plugins/git4idea/src/git4idea/rebase/GitRebaseSpec.java b/plugins/git4idea/src/git4idea/rebase/GitRebaseSpec.java
index d31b138e63ce..6839cb7095b6 100644
--- a/plugins/git4idea/src/git4idea/rebase/GitRebaseSpec.java
+++ b/plugins/git4idea/src/git4idea/rebase/GitRebaseSpec.java
@@ -27,7 +27,6 @@ import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.vcs.log.Hash;
import git4idea.GitLocalBranch;
-import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
import git4idea.branch.GitRebaseParams;
import git4idea.commands.Git;
@@ -169,8 +168,7 @@ public class GitRebaseSpec {
@NotNull
private static GitStashChangesSaver newSaver(@NotNull Project project, @NotNull ProgressIndicator indicator) {
Git git = ServiceManager.getService(Git.class);
- GitPlatformFacade facade = ServiceManager.getService(GitPlatformFacade.class);
- return new GitStashChangesSaver(project, facade, git, indicator, "Uncommitted changes before rebase");
+ return new GitStashChangesSaver(project, git, indicator, "Uncommitted changes before rebase");
}
@NotNull
diff --git a/plugins/git4idea/src/git4idea/rebase/GitRebaser.java b/plugins/git4idea/src/git4idea/rebase/GitRebaser.java
index c5669f09095f..183ff3031d8a 100644
--- a/plugins/git4idea/src/git4idea/rebase/GitRebaser.java
+++ b/plugins/git4idea/src/git4idea/rebase/GitRebaser.java
@@ -17,7 +17,6 @@ package git4idea.rebase;
import com.intellij.dvcs.DvcsUtil;
import com.intellij.openapi.application.AccessToken;
-import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
@@ -27,7 +26,6 @@ import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.openapi.vfs.VirtualFile;
-import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
import git4idea.GitVcs;
import git4idea.commands.*;
@@ -250,7 +248,7 @@ public class GitRebaser {
private boolean handleRebaseFailure(final VirtualFile root, final GitLineHandler h, GitRebaseProblemDetector rebaseConflictDetector) {
if (rebaseConflictDetector.isMergeConflict()) {
LOG.info("handleRebaseFailure merge conflict");
- return new GitConflictResolver(myProject, myGit, ServiceManager.getService(GitPlatformFacade.class), Collections.singleton(root), makeParamsForRebaseConflict()) {
+ return new GitConflictResolver(myProject, myGit, Collections.singleton(root), makeParamsForRebaseConflict()) {
@Override protected boolean proceedIfNothingToMerge() {
return continueRebase(root, "--continue");
}
@@ -356,7 +354,7 @@ public class GitRebaser {
@NotNull private final VirtualFile myRoot;
public ConflictResolver(@NotNull Project project, @NotNull Git git, @NotNull VirtualFile root, @NotNull GitRebaser rebaser) {
- super(project, git, ServiceManager.getService(GitPlatformFacade.class), Collections.singleton(root), makeParams());
+ super(project, git, Collections.singleton(root), makeParams());
myRebaser = rebaser;
myRoot = root;
}
diff --git a/plugins/git4idea/src/git4idea/repo/GitConfig.java b/plugins/git4idea/src/git4idea/repo/GitConfig.java
index fc35665e2f9d..bb5acb44a6c9 100644
--- a/plugins/git4idea/src/git4idea/repo/GitConfig.java
+++ b/plugins/git4idea/src/git4idea/repo/GitConfig.java
@@ -16,6 +16,8 @@
package git4idea.repo;
import com.intellij.ide.plugins.IdeaPluginDescriptor;
+import com.intellij.ide.plugins.PluginManager;
+import com.intellij.ide.plugins.PluginManagerCore;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Pair;
@@ -24,7 +26,6 @@ import com.intellij.util.ArrayUtil;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import git4idea.GitLocalBranch;
-import git4idea.GitPlatformFacade;
import git4idea.GitRemoteBranch;
import git4idea.branch.GitBranchUtil;
import org.ini4j.Ini;
@@ -119,7 +120,7 @@ public class GitConfig {
* If some section is invalid, it is skipped, and a warning is reported.
*/
@NotNull
- static GitConfig read(@NotNull GitPlatformFacade platformFacade, @NotNull File configFile) {
+ static GitConfig read(@NotNull File configFile) {
GitConfig emptyConfig = new GitConfig(Collections.emptyList(), Collections.emptyList(),
Collections.emptyList());
if (!configFile.exists()) {
@@ -138,7 +139,7 @@ public class GitConfig {
return emptyConfig;
}
- IdeaPluginDescriptor plugin = platformFacade.getPluginByClassName(GitConfig.class.getName());
+ IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginManagerCore.getPluginByClassName(GitConfig.class.getName()));
ClassLoader classLoader = plugin == null ?
GitConfig.class.getClassLoader() : // null e.g. if IDEA is started from IDEA
plugin.getPluginClassLoader();
diff --git a/plugins/git4idea/src/git4idea/repo/GitRemote.java b/plugins/git4idea/src/git4idea/repo/GitRemote.java
index c30326397149..cb5de098b721 100644
--- a/plugins/git4idea/src/git4idea/repo/GitRemote.java
+++ b/plugins/git4idea/src/git4idea/repo/GitRemote.java
@@ -15,7 +15,6 @@
*/
package git4idea.repo;
-import git4idea.GitPlatformFacade;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -38,7 +37,7 @@ import java.util.List;
* There are also some rules about url substitution, like {@code url..insteadOf}.
*
*
- * GitRemote instance constructed by {@link GitConfig#read(GitPlatformFacade, File)}} has all these rules applied.
+ * GitRemote instance constructed by {@link #read(File)}} has all these rules applied.
* Thus, for example, if only one {@code url} and no {@code pushUrls} are defined for the remote,
* both {@link #getUrls()} and {@link #getPushUrls()} will return this url.
* This is made to avoid urls transformation logic from the code using GitRemote, leaving it all in GitConfig parsing.
diff --git a/plugins/git4idea/src/git4idea/repo/GitRepositoryCreator.java b/plugins/git4idea/src/git4idea/repo/GitRepositoryCreator.java
index 551f14f4c322..ca3ba1b8f7e4 100644
--- a/plugins/git4idea/src/git4idea/repo/GitRepositoryCreator.java
+++ b/plugins/git4idea/src/git4idea/repo/GitRepositoryCreator.java
@@ -20,7 +20,6 @@ import com.intellij.dvcs.repo.VcsRepositoryCreator;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.VcsKey;
import com.intellij.openapi.vfs.VirtualFile;
-import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
import git4idea.GitVcs;
import org.jetbrains.annotations.NotNull;
@@ -28,11 +27,9 @@ import org.jetbrains.annotations.Nullable;
public class GitRepositoryCreator extends VcsRepositoryCreator {
@NotNull private final Project myProject;
- @NotNull private final GitPlatformFacade myPlatformFacade;
- public GitRepositoryCreator(@NotNull Project project, @NotNull GitPlatformFacade platformFacade) {
+ public GitRepositoryCreator(@NotNull Project project) {
myProject = project;
- myPlatformFacade = platformFacade;
}
@Override
diff --git a/plugins/git4idea/src/git4idea/repo/GitRepositoryImpl.java b/plugins/git4idea/src/git4idea/repo/GitRepositoryImpl.java
index bc099f612bd8..5982a1e202ee 100644
--- a/plugins/git4idea/src/git4idea/repo/GitRepositoryImpl.java
+++ b/plugins/git4idea/src/git4idea/repo/GitRepositoryImpl.java
@@ -18,13 +18,11 @@ package git4idea.repo;
import com.intellij.dvcs.repo.RepositoryImpl;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vfs.VirtualFile;
import git4idea.GitLocalBranch;
-import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
import git4idea.GitVcs;
import git4idea.branch.GitBranchesCollection;
@@ -38,7 +36,6 @@ import static com.intellij.util.ObjectUtils.assertNotNull;
public class GitRepositoryImpl extends RepositoryImpl implements GitRepository {
- @NotNull private final GitPlatformFacade myPlatformFacade;
@NotNull private final GitVcs myVcs;
@NotNull private final GitRepositoryReader myReader;
@NotNull private final VirtualFile myGitDir;
@@ -50,12 +47,10 @@ public class GitRepositoryImpl extends RepositoryImpl implements GitRepository {
private GitRepositoryImpl(@NotNull VirtualFile rootDir,
@NotNull VirtualFile gitDir,
- @NotNull GitPlatformFacade facade,
@NotNull Project project,
@NotNull Disposable parentDisposable,
final boolean light) {
super(project, rootDir, parentDisposable);
- myPlatformFacade = facade;
myVcs = assertNotNull(GitVcs.getInstance(project));
myGitDir = gitDir;
myRepositoryFiles = GitRepositoryFiles.getInstance(gitDir);
@@ -82,8 +77,7 @@ public class GitRepositoryImpl extends RepositoryImpl implements GitRepository {
@NotNull VirtualFile gitDir,
@NotNull Project project,
boolean listenToRepoChanges) {
- GitPlatformFacade platformFacade = ServiceManager.getService(project, GitPlatformFacade.class);
- GitRepositoryImpl repository = new GitRepositoryImpl(root, gitDir, platformFacade, project, project, !listenToRepoChanges);
+ GitRepositoryImpl repository = new GitRepositoryImpl(root, gitDir, project, project, !listenToRepoChanges);
if (listenToRepoChanges) {
repository.getUntrackedFilesHolder().setupVfsListener(project);
repository.setupUpdater();
@@ -203,7 +197,7 @@ public class GitRepositoryImpl extends RepositoryImpl implements GitRepository {
@NotNull
private GitRepoInfo readRepoInfo() {
File configFile = myRepositoryFiles.getConfigFile();
- GitConfig config = GitConfig.read(myPlatformFacade, configFile);
+ GitConfig config = GitConfig.read(configFile);
Collection remotes = config.parseRemotes();
GitBranchState state = myReader.readState(remotes);
Collection trackInfos = config.parseTrackInfos(state.getLocalBranches().keySet(), state.getRemoteBranches().keySet());
diff --git a/plugins/git4idea/src/git4idea/repo/GitRepositoryManager.java b/plugins/git4idea/src/git4idea/repo/GitRepositoryManager.java
index e72f8b8bb2c1..1900142360a7 100644
--- a/plugins/git4idea/src/git4idea/repo/GitRepositoryManager.java
+++ b/plugins/git4idea/src/git4idea/repo/GitRepositoryManager.java
@@ -21,6 +21,8 @@ import com.intellij.dvcs.repo.VcsRepositoryManager;
import com.intellij.openapi.project.Project;
import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
+import git4idea.GitVcs;
+import git4idea.config.GitVcsSettings;
import git4idea.rebase.GitRebaseSpec;
import git4idea.ui.branch.GitMultiRootBranchConfig;
import org.jetbrains.annotations.NotNull;
@@ -28,24 +30,31 @@ import org.jetbrains.annotations.Nullable;
import java.util.List;
+import static com.intellij.util.ObjectUtils.assertNotNull;
+
public class GitRepositoryManager extends AbstractRepositoryManager {
- @NotNull private final GitPlatformFacade myPlatformFacade;
- @NotNull private final Project myProject;
-
+ @NotNull private final GitVcsSettings mySettings;
@Nullable private volatile GitRebaseSpec myOngoingRebaseSpec;
+ /**
+ * @deprecated To remove in IDEA 2017. Use {@link #GitRepositoryManager(Project, VcsRepositoryManager)}.
+ */
+ @SuppressWarnings("UnusedParameters")
+ @Deprecated
public GitRepositoryManager(@NotNull Project project, @NotNull GitPlatformFacade platformFacade,
@NotNull VcsRepositoryManager vcsRepositoryManager) {
- super(vcsRepositoryManager, platformFacade.getVcs(project), GitUtil.DOT_GIT);
- myProject = project;
- myPlatformFacade = platformFacade;
+ this(project, vcsRepositoryManager);
+ }
+
+ public GitRepositoryManager(@NotNull Project project, @NotNull VcsRepositoryManager vcsRepositoryManager) {
+ super(vcsRepositoryManager, assertNotNull(GitVcs.getInstance(project)), GitUtil.DOT_GIT);
+ mySettings = GitVcsSettings.getInstance(project);
}
@Override
public boolean isSyncEnabled() {
- return myPlatformFacade.getSettings(myProject).getSyncSetting() == DvcsSyncSettings.Value.SYNC &&
- !new GitMultiRootBranchConfig(getRepositories()).diverged();
+ return mySettings.getSyncSetting() == DvcsSyncSettings.Value.SYNC && !new GitMultiRootBranchConfig(getRepositories()).diverged();
}
@NotNull
diff --git a/plugins/git4idea/src/git4idea/reset/GitResetOperation.java b/plugins/git4idea/src/git4idea/reset/GitResetOperation.java
index 5b6b3f8a6658..7c069524f83e 100644
--- a/plugins/git4idea/src/git4idea/reset/GitResetOperation.java
+++ b/plugins/git4idea/src/git4idea/reset/GitResetOperation.java
@@ -33,7 +33,6 @@ import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.MultiMap;
import com.intellij.util.ui.UIUtil;
import com.intellij.vcs.log.VcsFullCommitDetails;
-import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
import git4idea.branch.GitBranchUiHandlerImpl;
import git4idea.branch.GitSmartOperationDialog;
@@ -60,7 +59,6 @@ public class GitResetOperation {
@NotNull private final ProgressIndicator myIndicator;
@NotNull private final Git myGit;
@NotNull private final VcsNotifier myNotifier;
- @NotNull private final GitPlatformFacade myFacade;
@NotNull private final GitBranchUiHandlerImpl myUiHandler;
public GitResetOperation(@NotNull Project project, @NotNull Map targetCommits,
@@ -71,8 +69,7 @@ public class GitResetOperation {
myIndicator = indicator;
myGit = ServiceManager.getService(Git.class);
myNotifier = VcsNotifier.getInstance(project);
- myFacade = ServiceManager.getService(GitPlatformFacade.class);
- myUiHandler = new GitBranchUiHandlerImpl(myProject, myFacade, myGit, indicator);
+ myUiHandler = new GitBranchUiHandlerImpl(myProject, myGit, indicator);
}
public void execute() {
@@ -112,7 +109,7 @@ public class GitResetOperation {
int choice = myUiHandler.showSmartOperationDialog(myProject, affectedChanges, absolutePaths, "reset", "&Hard Reset");
if (choice == GitSmartOperationDialog.SMART_EXIT_CODE) {
final Ref result = Ref.create();
- new GitPreservingProcess(myProject, myFacade, myGit, Collections.singleton(repository.getRoot()), "reset", target,
+ new GitPreservingProcess(myProject, myGit, Collections.singleton(repository.getRoot()), "reset", target,
GitVcsSettings.UpdateChangesPolicy.STASH, myIndicator,
new Runnable() {
@Override
diff --git a/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java b/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java
index b415048fc5f3..70f4a99dc514 100644
--- a/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java
+++ b/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java
@@ -23,6 +23,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.VcsNotifier;
import com.intellij.openapi.vcs.changes.ChangeListManagerEx;
+import com.intellij.openapi.vcs.changes.ChangeListManagerImpl;
import com.intellij.openapi.vfs.VirtualFile;
import git4idea.GitPlatformFacade;
import git4idea.commands.Git;
@@ -45,7 +46,6 @@ public abstract class GitChangesSaver {
private static final Logger LOG = Logger.getInstance(GitChangesSaver.class);
@NotNull protected final Project myProject;
- @NotNull protected final GitPlatformFacade myPlatformFacade;
@NotNull protected final ChangeListManagerEx myChangeManager;
@NotNull protected final Git myGit;
@NotNull protected final ProgressIndicator myProgressIndicator;
@@ -59,25 +59,23 @@ public abstract class GitChangesSaver {
*/
@NotNull
public static GitChangesSaver getSaver(@NotNull Project project,
- @NotNull GitPlatformFacade platformFacade,
@NotNull Git git,
@NotNull ProgressIndicator progressIndicator,
@NotNull String stashMessage,
@NotNull GitVcsSettings.UpdateChangesPolicy saveMethod) {
if (saveMethod == GitVcsSettings.UpdateChangesPolicy.SHELVE) {
- return new GitShelveChangesSaver(project, platformFacade, git, progressIndicator, stashMessage);
+ return new GitShelveChangesSaver(project, git, progressIndicator, stashMessage);
}
- return new GitStashChangesSaver(project, platformFacade, git, progressIndicator, stashMessage);
+ return new GitStashChangesSaver(project, git, progressIndicator, stashMessage);
}
- protected GitChangesSaver(@NotNull Project project, @NotNull GitPlatformFacade platformFacade, @NotNull Git git,
+ protected GitChangesSaver(@NotNull Project project, @NotNull Git git,
@NotNull ProgressIndicator indicator, @NotNull String stashMessage) {
myProject = project;
- myPlatformFacade = platformFacade;
myGit = git;
myProgressIndicator = indicator;
myStashMessage = stashMessage;
- myChangeManager = platformFacade.getChangeListManager(project);
+ myChangeManager = ChangeListManagerImpl.getInstanceImpl(project);
}
/**
diff --git a/plugins/git4idea/src/git4idea/stash/GitShelveChangesSaver.java b/plugins/git4idea/src/git4idea/stash/GitShelveChangesSaver.java
index 6727c7a23481..abec770e263c 100644
--- a/plugins/git4idea/src/git4idea/stash/GitShelveChangesSaver.java
+++ b/plugins/git4idea/src/git4idea/stash/GitShelveChangesSaver.java
@@ -18,6 +18,7 @@ package git4idea.stash;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.shelf.ShelveChangesManager;
@@ -25,7 +26,6 @@ import com.intellij.openapi.vcs.changes.shelf.ShelvedChangeList;
import com.intellij.openapi.vcs.changes.shelf.ShelvedChangesViewManager;
import com.intellij.openapi.vcs.impl.LocalChangesUnderRoots;
import com.intellij.openapi.vfs.VirtualFile;
-import git4idea.GitPlatformFacade;
import git4idea.commands.Git;
import git4idea.i18n.GitBundle;
import git4idea.rollback.GitRollbackEnvironment;
@@ -35,22 +35,25 @@ import java.util.*;
public class GitShelveChangesSaver extends GitChangesSaver {
private static final Logger LOG = Logger.getInstance(GitShelveChangesSaver.class);
+
private final ShelveChangesManager myShelveManager;
private final ShelvedChangesViewManager myShelveViewManager;
+ private final ProjectLevelVcsManager myVcsManager;
+
private Map myShelvedLists;
- public GitShelveChangesSaver(@NotNull Project project, GitPlatformFacade platformFacade, @NotNull Git git,
- @NotNull ProgressIndicator indicator, String stashMessage) {
- super(project, platformFacade, git, indicator, stashMessage);
+ public GitShelveChangesSaver(@NotNull Project project, @NotNull Git git, @NotNull ProgressIndicator indicator, String stashMessage) {
+ super(project, git, indicator, stashMessage);
myShelveManager = ShelveChangesManager.getInstance(myProject);
myShelveViewManager = ShelvedChangesViewManager.getInstance(myProject);
+ myVcsManager = ProjectLevelVcsManager.getInstance(myProject);
}
@Override
protected void save(@NotNull Collection rootsToSave) throws VcsException {
LOG.info("save " + rootsToSave);
final Map>> lists =
- new LocalChangesUnderRoots(myChangeManager, myPlatformFacade.getVcsManager(myProject)).getChangesByLists(rootsToSave);
+ new LocalChangesUnderRoots(myChangeManager, myVcsManager).getChangesByLists(rootsToSave);
String oldProgressTitle = myProgressIndicator.getText();
myProgressIndicator.setText(GitBundle.getString("update.shelving.changes"));
diff --git a/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java b/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java
index 0d91e388d846..921a2e29823d 100644
--- a/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java
+++ b/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java
@@ -28,7 +28,7 @@ import com.intellij.openapi.vcs.merge.MergeDialogCustomizer;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.ContainerUtil;
-import git4idea.GitPlatformFacade;
+import git4idea.GitUtil;
import git4idea.commands.Git;
import git4idea.commands.GitCommandResult;
import git4idea.commands.GitHandlerUtil;
@@ -55,12 +55,11 @@ public class GitStashChangesSaver extends GitChangesSaver {
@NotNull private final Set myStashedRoots = ContainerUtil.newHashSet(); // save stashed roots to unstash only them
public GitStashChangesSaver(@NotNull Project project,
- @NotNull GitPlatformFacade platformFacade,
@NotNull Git git,
@NotNull ProgressIndicator progressIndicator,
@NotNull String stashMessage) {
- super(project, platformFacade, git, progressIndicator, stashMessage);
- myRepositoryManager = platformFacade.getRepositoryManager(project);
+ super(project, git, progressIndicator, stashMessage);
+ myRepositoryManager = GitUtil.getRepositoryManager(project);
}
@Override
@@ -106,7 +105,7 @@ public class GitStashChangesSaver extends GitChangesSaver {
loadRoot(root);
}
- boolean conflictsResolved = new UnstashConflictResolver(myProject, myPlatformFacade, myGit, myStashedRoots, myParams).merge();
+ boolean conflictsResolved = new UnstashConflictResolver(myProject, myGit, myStashedRoots, myParams).merge();
LOG.info("load: conflicts resolved status is " + conflictsResolved + " in roots " + myStashedRoots);
}
@@ -170,9 +169,9 @@ public class GitStashChangesSaver extends GitChangesSaver {
private final Set myStashedRoots;
- public UnstashConflictResolver(@NotNull Project project, GitPlatformFacade platformFacade, @NotNull Git git,
+ public UnstashConflictResolver(@NotNull Project project, @NotNull Git git,
@NotNull Set stashedRoots, @Nullable Params params) {
- super(project, git, platformFacade, stashedRoots, makeParamsOrUse(params));
+ super(project, git, stashedRoots, makeParamsOrUse(params));
myStashedRoots = stashedRoots;
}
diff --git a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java
index 9be52ed5cf57..fdf416341c80 100644
--- a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java
+++ b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java
@@ -38,10 +38,10 @@ import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.VcsNotifier;
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
import com.intellij.openapi.vcs.merge.MergeDialogCustomizer;
+import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.DocumentAdapter;
import com.intellij.util.Consumer;
-import git4idea.GitPlatformFacade;
import git4idea.GitRevisionNumber;
import git4idea.GitUtil;
import git4idea.GitVcs;
@@ -53,8 +53,8 @@ import git4idea.merge.GitConflictResolver;
import git4idea.repo.GitRepository;
import git4idea.stash.GitStashUtils;
import git4idea.util.GitUIUtil;
-import git4idea.util.LocalChangesWouldBeOverwrittenHelper;
import git4idea.util.GitUntrackedFilesHelper;
+import git4idea.util.LocalChangesWouldBeOverwrittenHelper;
import git4idea.validators.GitBranchNameValidator;
import org.jetbrains.annotations.NotNull;
@@ -373,7 +373,7 @@ public class GitUnstashDialog extends DialogWrapper {
if (!completed) return;
- ServiceManager.getService(myProject, GitPlatformFacade.class).hardRefresh(root);
+ VfsUtil.markDirtyAndRefresh(false, true, false, root);
GitCommandResult res = result.get();
if (conflict.get()) {
boolean conflictsResolved = new UnstashConflictResolver(myProject, root, getSelectedStash()).merge();
@@ -404,7 +404,7 @@ public class GitUnstashDialog extends DialogWrapper {
private final StashInfo myStashInfo;
public UnstashConflictResolver(Project project, VirtualFile root, StashInfo stashInfo) {
- super(project, ServiceManager.getService(Git.class), ServiceManager.getService(GitPlatformFacade.class),
+ super(project, ServiceManager.getService(Git.class),
Collections.singleton(root), makeParams(stashInfo));
myRoot = root;
myStashInfo = stashInfo;
diff --git a/plugins/git4idea/src/git4idea/ui/branch/GitLogBranchOperationsActionGroup.java b/plugins/git4idea/src/git4idea/ui/branch/GitLogBranchOperationsActionGroup.java
index e4aa432eb6fe..9b0ef8ace06b 100644
--- a/plugins/git4idea/src/git4idea/ui/branch/GitLogBranchOperationsActionGroup.java
+++ b/plugins/git4idea/src/git4idea/ui/branch/GitLogBranchOperationsActionGroup.java
@@ -21,11 +21,8 @@ import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
-import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.vcs.log.*;
-import com.intellij.vcs.log.data.RefsModel;
-import git4idea.GitPlatformFacade;
import git4idea.config.GitVcsSettings;
import git4idea.log.GitRefManager;
import git4idea.repo.GitRepository;
@@ -90,7 +87,7 @@ public class GitLogBranchOperationsActionGroup extends ActionGroup implements Du
if (vcsRefs.isEmpty()) return AnAction.EMPTY_ARRAY;
- GitVcsSettings settings = ServiceManager.getService(project, GitPlatformFacade.class).getSettings(project);
+ GitVcsSettings settings = GitVcsSettings.getInstance(project);
boolean showBranchesPopup = vcsRefs.size() > MAX_BRANCH_GROUPS;
List branchActionGroups = new ArrayList();
diff --git a/plugins/git4idea/src/git4idea/update/GitMergeUpdater.java b/plugins/git4idea/src/git4idea/update/GitMergeUpdater.java
index 38b5505fdc27..acf5418663af 100644
--- a/plugins/git4idea/src/git4idea/update/GitMergeUpdater.java
+++ b/plugins/git4idea/src/git4idea/update/GitMergeUpdater.java
@@ -275,7 +275,7 @@ public class GitMergeUpdater extends GitUpdater {
private final VirtualFile myRoot;
public MyConflictResolver(Project project, @NotNull Git git, GitMerger merger, VirtualFile root) {
- super(project, git, ServiceManager.getService(git4idea.GitPlatformFacade.class), Collections.singleton(root), makeParams());
+ super(project, git, Collections.singleton(root), makeParams());
myMerger = merger;
myRoot = root;
}
diff --git a/plugins/git4idea/src/git4idea/update/GitUpdateEnvironment.java b/plugins/git4idea/src/git4idea/update/GitUpdateEnvironment.java
index b7903cc2b719..f2ad35e42ac8 100644
--- a/plugins/git4idea/src/git4idea/update/GitUpdateEnvironment.java
+++ b/plugins/git4idea/src/git4idea/update/GitUpdateEnvironment.java
@@ -15,7 +15,6 @@
*/
package git4idea.update;
-import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
@@ -27,7 +26,6 @@ import com.intellij.openapi.vcs.update.UpdateEnvironment;
import com.intellij.openapi.vcs.update.UpdateSession;
import com.intellij.openapi.vcs.update.UpdatedFiles;
import com.intellij.openapi.vfs.VirtualFile;
-import git4idea.GitPlatformFacade;
import git4idea.config.GitVcsSettings;
import git4idea.repo.GitRepositoryManager;
import org.jetbrains.annotations.NotNull;
@@ -42,12 +40,10 @@ import static git4idea.GitUtil.*;
public class GitUpdateEnvironment implements UpdateEnvironment {
private final Project myProject;
private final GitVcsSettings mySettings;
- @NotNull private final GitPlatformFacade myPlatformFacade;
public GitUpdateEnvironment(@NotNull Project project, @NotNull GitVcsSettings settings) {
myProject = project;
mySettings = settings;
- myPlatformFacade = ServiceManager.getService(project, GitPlatformFacade.class);
}
public void fillGroups(UpdatedFiles updatedFiles) {
@@ -58,7 +54,7 @@ public class GitUpdateEnvironment implements UpdateEnvironment {
public UpdateSession updateDirectories(@NotNull FilePath[] filePaths, UpdatedFiles updatedFiles, ProgressIndicator progressIndicator, @NotNull Ref sequentialUpdatesContextRef) throws ProcessCanceledException {
Set roots = gitRoots(Arrays.asList(filePaths));
GitRepositoryManager repositoryManager = getRepositoryManager(myProject);
- final GitUpdateProcess gitUpdateProcess = new GitUpdateProcess(myProject, myPlatformFacade,
+ final GitUpdateProcess gitUpdateProcess = new GitUpdateProcess(myProject,
progressIndicator, getRepositoriesFromRoots(repositoryManager, roots),
updatedFiles, true);
boolean result = gitUpdateProcess.update(mySettings.getUpdateType()).isSuccess();
diff --git a/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java b/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java
index 741918c6c1ec..a88b250cab5c 100644
--- a/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java
+++ b/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java
@@ -35,7 +35,6 @@ import com.intellij.util.Function;
import com.intellij.util.ObjectUtils;
import com.intellij.util.containers.ContainerUtil;
import git4idea.GitLocalBranch;
-import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
import git4idea.branch.GitBranchPair;
import git4idea.branch.GitBranchUtil;
@@ -68,7 +67,6 @@ public class GitUpdateProcess {
@NotNull private final Project myProject;
@NotNull private final Git myGit;
- @NotNull private final GitPlatformFacade myPlatformFacade;
@NotNull private final Collection myRepositories;
private final boolean myCheckRebaseOverMergeProblem;
private final UpdatedFiles myUpdatedFiles;
@@ -78,13 +76,11 @@ public class GitUpdateProcess {
private final Map myTrackedBranches = new HashMap();
public GitUpdateProcess(@NotNull Project project,
- @NotNull GitPlatformFacade platformFacade,
@Nullable ProgressIndicator progressIndicator,
@NotNull Collection repositories,
@NotNull UpdatedFiles updatedFiles,
boolean checkRebaseOverMergeProblem) {
myProject = project;
- myPlatformFacade = platformFacade;
myRepositories = repositories;
myCheckRebaseOverMergeProblem = checkRebaseOverMergeProblem;
myGit = ServiceManager.getService(Git.class);
@@ -193,7 +189,7 @@ public class GitUpdateProcess {
final Ref compoundResult = Ref.create();
final Map finalUpdaters = updaters;
- new GitPreservingProcess(myProject, myPlatformFacade, myGit, myRootsToSave, "Update", "Remote",
+ new GitPreservingProcess(myProject, myGit, myRootsToSave, "Update", "Remote",
GitVcsSettings.getInstance(myProject).updateChangesPolicy(), myProgressIndicator, new Runnable() {
@Override
public void run() {
@@ -387,7 +383,7 @@ public class GitUpdateProcess {
params.setMergeDescription("You have unfinished rebase process. These conflicts must be resolved before update.");
params.setErrorNotificationAdditionalDescription("Then you may continue rebase.
You also may abort rebase to restore the original branch and stop rebasing.");
params.setReverse(true);
- return !new GitConflictResolver(myProject, myGit, ServiceManager.getService(GitPlatformFacade.class), rebasingRoots, params) {
+ return !new GitConflictResolver(myProject, myGit, rebasingRoots, params) {
@Override protected boolean proceedIfNothingToMerge() {
return rebaser.continueRebase(rebasingRoots);
}
diff --git a/plugins/git4idea/src/git4idea/util/GitFreezingProcess.java b/plugins/git4idea/src/git4idea/util/GitFreezingProcess.java
index 2fe82b5ab087..d2202d791d7d 100644
--- a/plugins/git4idea/src/git4idea/util/GitFreezingProcess.java
+++ b/plugins/git4idea/src/git4idea/util/GitFreezingProcess.java
@@ -15,13 +15,20 @@
*/
package git4idea.util;
+import com.intellij.ide.SaveAndSyncHandler;
+import com.intellij.openapi.application.Application;
+import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.project.ex.ProjectManagerEx;
+import com.intellij.openapi.vcs.changes.ChangeListManager;
import com.intellij.openapi.vcs.changes.ChangeListManagerEx;
import com.intellij.util.ui.UIUtil;
-import git4idea.GitPlatformFacade;
import org.jetbrains.annotations.NotNull;
+import static com.intellij.openapi.application.ModalityState.defaultModalityState;
+
/**
* Executes an action surrounding it with freezing-unfreezing of the ChangeListManager
* and blocking/unblocking save/sync on frame de/activation.
@@ -30,17 +37,22 @@ public class GitFreezingProcess {
private static final Logger LOG = Logger.getInstance(GitFreezingProcess.class);
- @NotNull private final GitPlatformFacade myFacade;
@NotNull private final String myOperationTitle;
@NotNull private final Runnable myRunnable;
- @NotNull private final ChangeListManagerEx myChangeListManager;
- public GitFreezingProcess(@NotNull Project project, @NotNull GitPlatformFacade facade,
- @NotNull String operationTitle, @NotNull Runnable runnable) {
- myFacade = facade;
+ @NotNull private final Application myApplication;
+ @NotNull private final ChangeListManagerEx myChangeListManager;
+ @NotNull private final ProjectManagerEx myProjectManager;
+ @NotNull private final SaveAndSyncHandler mySaveAndSyncHandler;
+
+ public GitFreezingProcess(@NotNull Project project, @NotNull String operationTitle, @NotNull Runnable runnable) {
myOperationTitle = operationTitle;
myRunnable = runnable;
- myChangeListManager = myFacade.getChangeListManager(project);
+
+ myApplication = ApplicationManager.getApplication();
+ myChangeListManager = (ChangeListManagerEx)ChangeListManager.getInstance(project);
+ myProjectManager = ProjectManagerEx.getInstanceEx();
+ mySaveAndSyncHandler = SaveAndSyncHandler.getInstance();
}
public void execute() {
@@ -67,17 +79,17 @@ public class GitFreezingProcess {
LOG.debug("finished.");
}
- public static void saveAndBlock(@NotNull GitPlatformFacade platformFacade) {
- platformFacade.getProjectManager().blockReloadingProjectOnExternalChanges();
- platformFacade.saveAllDocuments();
- platformFacade.getSaveAndSyncHandler().blockSaveOnFrameDeactivation();
- platformFacade.getSaveAndSyncHandler().blockSyncOnFrameActivation();
+ public void saveAndBlock() {
+ myProjectManager.blockReloadingProjectOnExternalChanges();
+ myApplication.invokeAndWait(() -> FileDocumentManager.getInstance().saveAllDocuments(), defaultModalityState());
+ mySaveAndSyncHandler.blockSaveOnFrameDeactivation();
+ mySaveAndSyncHandler.blockSyncOnFrameActivation();
}
private void saveAndBlockInAwt() {
RethrowingRunnable rethrowingRunnable = new RethrowingRunnable(new Runnable() {
@Override public void run() {
- saveAndBlock(myFacade);
+ saveAndBlock();
}
});
UIUtil.invokeAndWaitIfNeeded(rethrowingRunnable);
@@ -87,17 +99,17 @@ public class GitFreezingProcess {
private void unblockInAwt() {
RethrowingRunnable rethrowingRunnable = new RethrowingRunnable(new Runnable() {
@Override public void run() {
- unblock(myFacade);
+ unblock();
}
});
UIUtil.invokeAndWaitIfNeeded(rethrowingRunnable);
rethrowingRunnable.rethrowIfHappened();
}
- public static void unblock(@NotNull GitPlatformFacade platformFacade) {
- platformFacade.getProjectManager().unblockReloadingProjectOnExternalChanges();
- platformFacade.getSaveAndSyncHandler().unblockSaveOnFrameDeactivation();
- platformFacade.getSaveAndSyncHandler().unblockSyncOnFrameActivation();
+ public void unblock() {
+ myProjectManager.unblockReloadingProjectOnExternalChanges();
+ mySaveAndSyncHandler.unblockSaveOnFrameDeactivation();
+ mySaveAndSyncHandler.unblockSyncOnFrameActivation();
}
private void freeze() {
diff --git a/plugins/git4idea/src/git4idea/util/GitPreservingProcess.java b/plugins/git4idea/src/git4idea/util/GitPreservingProcess.java
index 93e472baae2b..649289f7cbd8 100644
--- a/plugins/git4idea/src/git4idea/util/GitPreservingProcess.java
+++ b/plugins/git4idea/src/git4idea/util/GitPreservingProcess.java
@@ -27,7 +27,6 @@ import com.intellij.openapi.vcs.history.VcsRevisionNumber;
import com.intellij.openapi.vcs.merge.MergeDialogCustomizer;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.text.DateFormatUtil;
-import git4idea.GitPlatformFacade;
import git4idea.commands.Git;
import git4idea.config.GitVcsSettings;
import git4idea.merge.GitConflictResolver;
@@ -49,7 +48,6 @@ public class GitPreservingProcess {
private static final Logger LOG = Logger.getInstance(GitPreservingProcess.class);
@NotNull private final Project myProject;
- @NotNull private final GitPlatformFacade myFacade;
@NotNull private final Git myGit;
@NotNull private final Collection myRootsToSave;
@NotNull private final String myOperationTitle;
@@ -62,7 +60,6 @@ public class GitPreservingProcess {
@NotNull private final AtomicBoolean myLoaded = new AtomicBoolean();
public GitPreservingProcess(@NotNull Project project,
- @NotNull GitPlatformFacade facade,
@NotNull Git git,
@NotNull Collection rootsToSave,
@NotNull String operationTitle,
@@ -71,7 +68,6 @@ public class GitPreservingProcess {
@NotNull ProgressIndicator indicator,
@NotNull Runnable operation) {
myProject = project;
- myFacade = facade;
myGit = git;
myRootsToSave = rootsToSave;
myOperationTitle = operationTitle;
@@ -114,7 +110,7 @@ public class GitPreservingProcess {
}
};
- new GitFreezingProcess(myProject, myFacade, myOperationTitle, operation).execute();
+ new GitFreezingProcess(myProject, myOperationTitle, operation).execute();
}
/**
@@ -122,7 +118,7 @@ public class GitPreservingProcess {
*/
@NotNull
private GitChangesSaver configureSaver(@NotNull GitVcsSettings.UpdateChangesPolicy saveMethod) {
- GitChangesSaver saver = GitChangesSaver.getSaver(myProject, myFacade, myGit, myProgressIndicator, myStashMessage, saveMethod);
+ GitChangesSaver saver = GitChangesSaver.getSaver(myProject, myGit, myProgressIndicator, myStashMessage, saveMethod);
MergeDialogCustomizer mergeDialogCustomizer = new MergeDialogCustomizer() {
@Override
public String getMultipleFileMergeDescription(@NotNull Collection files) {
diff --git a/plugins/git4idea/test-stepdefs/git4idea/GitAddSteps.java b/plugins/git4idea/test-stepdefs/git4idea/GitAddSteps.java
index 2c19f3718370..962fa5527ece 100644
--- a/plugins/git4idea/test-stepdefs/git4idea/GitAddSteps.java
+++ b/plugins/git4idea/test-stepdefs/git4idea/GitAddSteps.java
@@ -29,6 +29,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.List;
import static git4idea.GitCucumberWorld.myProject;
+import static git4idea.GitCucumberWorld.myRepositoryManager;
import static git4idea.test.GitExecutor.cd;
import static git4idea.test.GitExecutor.git;
import static org.junit.Assert.assertNotNull;
@@ -63,7 +64,7 @@ public class GitAddSteps {
public void file_should_become_ADDED(String filePath) throws Throwable {
VirtualFile vf = GitCucumberWorld.myProjectDir.findFileByRelativePath(filePath);
assertNotNull(vf);
- GitRepository repo = GitCucumberWorld.myPlatformFacade.getRepositoryManager(GitCucumberWorld.myProject).getRepositoryForFile(vf);
+ GitRepository repo = myRepositoryManager.getRepositoryForFile(vf);
String status = git(repo, "status --porcelain " + vf.getPath());
assertTrue("File status is not-changed: " + status, !status.isEmpty());
assertTrue("File status is not added: " + status, 'A' == status.charAt(0));
diff --git a/plugins/git4idea/test-stepdefs/git4idea/GitCherryPickStepdefs.java b/plugins/git4idea/test-stepdefs/git4idea/GitCherryPickStepdefs.java
index 07661c0ecf02..7ec923537657 100644
--- a/plugins/git4idea/test-stepdefs/git4idea/GitCherryPickStepdefs.java
+++ b/plugins/git4idea/test-stepdefs/git4idea/GitCherryPickStepdefs.java
@@ -46,16 +46,12 @@ import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
-/**
- * @author Kirill Likhodedov
- */
-
public class GitCherryPickStepdefs {
@Given("^(enabled|disabled) auto-commit in the settings$")
public void auto_commit_in_the_settings(String state) {
boolean enabled = state.equals("enabled");
- myPlatformFacade.getSettings(myProject).setAutoCommitOnCherryPick(enabled);
+ mySettings.setAutoCommitOnCherryPick(enabled);
}
@When("^I cherry-pick the commit (\\w+)$")
@@ -240,7 +236,7 @@ public class GitCherryPickStepdefs {
return virtualCommits.getRealCommit(virtualHash).getHash();
}
}), myProjectDir);
- new GitCherryPicker(myProject, myGit, myPlatformFacade).cherryPick(commits);
+ new GitCherryPicker(myProject, myGit).cherryPick(commits);
}
private static List loadDetails(List hashes, @NotNull VirtualFile root) throws VcsException {
diff --git a/plugins/git4idea/test-stepdefs/git4idea/GitCucumberWorld.java b/plugins/git4idea/test-stepdefs/git4idea/GitCucumberWorld.java
index d2733b600b9b..05ac17a7fd8c 100644
--- a/plugins/git4idea/test-stepdefs/git4idea/GitCucumberWorld.java
+++ b/plugins/git4idea/test-stepdefs/git4idea/GitCucumberWorld.java
@@ -37,6 +37,7 @@ import git4idea.commands.Git;
import git4idea.commands.GitHttpAuthService;
import git4idea.config.GitVcsSettings;
import git4idea.repo.GitRepository;
+import git4idea.repo.GitRepositoryManager;
import git4idea.test.GitExecutor;
import git4idea.test.GitHttpAuthTestService;
import git4idea.test.GitTestUtil;
@@ -74,11 +75,11 @@ public class GitCucumberWorld {
public static VirtualFile myProjectDir;
public static Project myProject;
- public static GitPlatformFacade myPlatformFacade;
public static Git myGit;
public static GitRepository myRepository;
public static GitVcsSettings mySettings;
public static ChangeListManagerImpl myChangeListManager;
+ public static GitRepositoryManager myRepositoryManager;
public static GitVcs myVcs;
public static MockVcsHelper myVcsHelper;
@@ -114,17 +115,17 @@ public class GitCucumberWorld {
myProjectDir = myProject.getBaseDir();
myTestRoot = myProjectRoot;
- myPlatformFacade = ServiceManager.getService(myProject, GitPlatformFacade.class);
myGit = ServiceManager.getService(myProject, Git.class);
- mySettings = myPlatformFacade.getSettings(myProject);
+ mySettings = GitVcsSettings.getInstance(myProject);
mySettings.getAppSettings().setPathToGit(GitExecutor.PathHolder.GIT_EXECUTABLE);
// dynamic overriding is used instead of making it in plugin.xml,
// because MockVcsHelper is not ready to be a full featured implementation for all tests.
myVcsHelper = GitTestUtil.overrideService(myProject, AbstractVcsHelper.class, MockVcsHelper.class);
- myChangeListManager = (ChangeListManagerImpl)myPlatformFacade.getChangeListManager(myProject);
+ myChangeListManager = ChangeListManagerImpl.getInstanceImpl(myProject);
myNotificator = (TestVcsNotifier)ServiceManager.getService(myProject, VcsNotifier.class);
myVcs = GitVcs.getInstance(myProject);
+ myRepositoryManager = GitUtil.getRepositoryManager(myProject);
virtualCommits = new GitTestVirtualCommitsHolder();
myAsyncTasks = new ArrayList();
diff --git a/plugins/git4idea/tests/git4idea/branch/GitBranchWorkerTest.java b/plugins/git4idea/tests/git4idea/branch/GitBranchWorkerTest.java
index 2169231e747c..1fecb221df39 100644
--- a/plugins/git4idea/tests/git4idea/branch/GitBranchWorkerTest.java
+++ b/plugins/git4idea/tests/git4idea/branch/GitBranchWorkerTest.java
@@ -498,7 +498,7 @@ public class GitBranchWorkerTest extends GitPlatformTest {
// IDEA-99849
prepareLocalChangesOverwrittenBy(myUltimate);
- GitBranchWorker brancher = new GitBranchWorker(myProject, myPlatformFacade, myGit, new TestUiHandler() {
+ GitBranchWorker brancher = new GitBranchWorker(myProject, myGit, new TestUiHandler() {
@Override
public int showSmartOperationDialog(@NotNull Project project,
@NotNull List changes,
@@ -526,7 +526,7 @@ public class GitBranchWorkerTest extends GitPlatformTest {
unmergedFiles(myCommunity);
final Ref rollbackProposed = Ref.create(false);
- GitBranchWorker brancher = new GitBranchWorker(myProject, myPlatformFacade, myGit, new TestUiHandler() {
+ GitBranchWorker brancher = new GitBranchWorker(myProject, myGit, new TestUiHandler() {
@Override
public boolean showUnmergedFilesMessageWithRollback(@NotNull String operationName, @NotNull String rollbackProposal) {
rollbackProposed.set(true);
@@ -695,7 +695,7 @@ public class GitBranchWorkerTest extends GitPlatformTest {
// delete feature fully merged to current HEAD, but not to the upstream
final Ref dialogShown = Ref.create(false);
- GitBranchWorker brancher = new GitBranchWorker(myProject, myPlatformFacade, myGit, new TestUiHandler() {
+ GitBranchWorker brancher = new GitBranchWorker(myProject, myGit, new TestUiHandler() {
@Override
public boolean showBranchIsNotFullyMergedDialog(@NotNull Project project,
@NotNull Map> history,
@@ -902,27 +902,27 @@ public class GitBranchWorkerTest extends GitPlatformTest {
}
private void checkoutNewBranch(String name, GitBranchUiHandler uiHandler) {
- GitBranchWorker brancher = new GitBranchWorker(myProject, myPlatformFacade, myGit, uiHandler);
+ GitBranchWorker brancher = new GitBranchWorker(myProject, myGit, uiHandler);
brancher.checkoutNewBranch(name, myRepositories);
}
private void checkoutBranch(String name, GitBranchUiHandler uiHandler) {
- GitBranchWorker brancher = new GitBranchWorker(myProject, myPlatformFacade, myGit, uiHandler);
+ GitBranchWorker brancher = new GitBranchWorker(myProject, myGit, uiHandler);
brancher.checkout(name, false, myRepositories);
}
private void checkoutRevision(String reference, GitBranchUiHandler uiHandler) {
- GitBranchWorker brancher = new GitBranchWorker(myProject, myPlatformFacade, myGit, uiHandler);
+ GitBranchWorker brancher = new GitBranchWorker(myProject, myGit, uiHandler);
brancher.checkout(reference, true, myRepositories);
}
private void mergeBranch(String name, GitBranchUiHandler uiHandler) {
- GitBranchWorker brancher = new GitBranchWorker(myProject, myPlatformFacade, myGit, uiHandler);
+ GitBranchWorker brancher = new GitBranchWorker(myProject, myGit, uiHandler);
brancher.merge(name, GitBrancher.DeleteOnMergeOption.PROPOSE, myRepositories);
}
private void deleteBranch(String name, GitBranchUiHandler uiHandler) {
- GitBranchWorker brancher = new GitBranchWorker(myProject, myPlatformFacade, myGit, uiHandler);
+ GitBranchWorker brancher = new GitBranchWorker(myProject, myGit, uiHandler);
brancher.deleteBranch(name, myRepositories);
}
diff --git a/plugins/git4idea/tests/git4idea/crlf/GitCrlfProblemsDetectorTest.java b/plugins/git4idea/tests/git4idea/crlf/GitCrlfProblemsDetectorTest.java
index 4c8d2d41f5c8..2af33bf1a62f 100644
--- a/plugins/git4idea/tests/git4idea/crlf/GitCrlfProblemsDetectorTest.java
+++ b/plugins/git4idea/tests/git4idea/crlf/GitCrlfProblemsDetectorTest.java
@@ -128,7 +128,7 @@ public class GitCrlfProblemsDetectorTest extends GitSingleRepoTest {
}
});
assertTrue("Warning should be done, since one of the files has CRLFs and no related attributes",
- GitCrlfProblemsDetector.detect(myProject, myPlatformFacade, myGit, files).shouldWarn());
+ GitCrlfProblemsDetector.detect(myProject, myGit, files).shouldWarn());
}
private void gitattributes(String content) throws IOException {
@@ -140,7 +140,7 @@ public class GitCrlfProblemsDetectorTest extends GitSingleRepoTest {
}
private GitCrlfProblemsDetector detect(VirtualFile file) {
- return GitCrlfProblemsDetector.detect(myProject, myPlatformFacade, myGit, Collections.singleton(file));
+ return GitCrlfProblemsDetector.detect(myProject, myGit, Collections.singleton(file));
}
private void createCrlfFile(String relPath) throws IOException {
diff --git a/plugins/git4idea/tests/git4idea/rebase/GitMultiRepoRebaseTest.kt b/plugins/git4idea/tests/git4idea/rebase/GitMultiRepoRebaseTest.kt
index 2cc2664b8549..919cd0d7a04a 100644
--- a/plugins/git4idea/tests/git4idea/rebase/GitMultiRepoRebaseTest.kt
+++ b/plugins/git4idea/tests/git4idea/rebase/GitMultiRepoRebaseTest.kt
@@ -212,7 +212,7 @@ class GitMultiRepoRebaseTest : GitRebaseBaseTest() {
val uiHandler = Mockito.mock(GitBranchUiHandler::class.java)
Mockito.`when`(uiHandler.progressIndicator).thenReturn(EmptyProgressIndicator())
try {
- GitBranchWorker(myProject, myPlatformFacade, myGit, uiHandler).rebaseOnCurrent(myAllRepositories, "feature")
+ GitBranchWorker(myProject, myGit, uiHandler).rebaseOnCurrent(myAllRepositories, "feature")
}
finally {
myGit.setShouldRebaseFail { false }
diff --git a/plugins/git4idea/tests/git4idea/rebase/GitSingleRepoRebaseTest.kt b/plugins/git4idea/tests/git4idea/rebase/GitSingleRepoRebaseTest.kt
index c3e115a4925d..59af0e076887 100644
--- a/plugins/git4idea/tests/git4idea/rebase/GitSingleRepoRebaseTest.kt
+++ b/plugins/git4idea/tests/git4idea/rebase/GitSingleRepoRebaseTest.kt
@@ -470,7 +470,7 @@ class GitSingleRepoRebaseTest : GitRebaseBaseTest() {
val uiHandler = Mockito.mock(GitBranchUiHandler::class.java)
`when`(uiHandler.progressIndicator).thenReturn(EmptyProgressIndicator())
- GitBranchWorker(myProject, myPlatformFacade, myGit, uiHandler).rebaseOnCurrent(listOf(myRepo), "feature")
+ GitBranchWorker(myProject, myGit, uiHandler).rebaseOnCurrent(listOf(myRepo), "feature")
assertSuccessfulNotification("Checked out feature and rebased it on master")
myRepo.`assert feature rebased on master`()
diff --git a/plugins/git4idea/tests/git4idea/repo/GitConfigTest.java b/plugins/git4idea/tests/git4idea/repo/GitConfigTest.java
index d93e2e13b2e2..29784a6e9ea2 100644
--- a/plugins/git4idea/tests/git4idea/repo/GitConfigTest.java
+++ b/plugins/git4idea/tests/git4idea/repo/GitConfigTest.java
@@ -64,7 +64,7 @@ public class GitConfigTest extends GitPlatformTest {
git("branch --track a#branch origin/a#branch");
File gitDir = new File(myProjectPath, ".git");
- GitConfig config = GitConfig.read(myPlatformFacade, new File(gitDir, "config"));
+ GitConfig config = GitConfig.read(new File(gitDir, "config"));
VirtualFile dir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(gitDir);
GitRepositoryReader reader = new GitRepositoryReader(GitRepositoryFiles.getInstance(dir));
GitBranchState state = reader.readState(config.parseRemotes());
@@ -114,12 +114,12 @@ public class GitConfigTest extends GitPlatformTest {
private void assertSingleRemoteInConfig() {
File gitDir = new File(myProjectPath, ".git");
- Collection remotes = GitConfig.read(myPlatformFacade, new File(gitDir, "config")).parseRemotes();
+ Collection remotes = GitConfig.read(new File(gitDir, "config")).parseRemotes();
assertSingleRemote(remotes);
}
private void doTestRemotes(String testName, File configFile, File resultFile) throws IOException {
- GitConfig config = GitConfig.read(myPlatformFacade, configFile);
+ GitConfig config = GitConfig.read(configFile);
VcsTestUtil.assertEqualCollections(testName, config.parseRemotes(), readRemoteResults(resultFile));
}
@@ -141,7 +141,7 @@ public class GitConfigTest extends GitPlatformTest {
});
VcsTestUtil.assertEqualCollections(testName,
- GitConfig.read(myPlatformFacade, configFile).parseTrackInfos(localBranches, remoteBranches),
+ GitConfig.read(configFile).parseTrackInfos(localBranches, remoteBranches),
expectedInfos);
}
diff --git a/plugins/git4idea/tests/git4idea/repo/GitRepositoryReaderNewTest.kt b/plugins/git4idea/tests/git4idea/repo/GitRepositoryReaderNewTest.kt
index 5ab39996515b..98265ee86917 100644
--- a/plugins/git4idea/tests/git4idea/repo/GitRepositoryReaderNewTest.kt
+++ b/plugins/git4idea/tests/git4idea/repo/GitRepositoryReaderNewTest.kt
@@ -162,7 +162,7 @@ class GitRepositoryReaderNewTest : GitSingleRepoTest() {
private fun readState(): GitBranchState {
val gitFiles = myRepo.repositoryFiles
- val config = GitConfig.read(myPlatformFacade, gitFiles.configFile)
+ val config = GitConfig.read(gitFiles.configFile)
val reader = GitRepositoryReader(gitFiles)
val remotes = config.parseRemotes()
return reader.readState(remotes)
diff --git a/plugins/git4idea/tests/git4idea/repo/GitRepositoryReaderTest.java b/plugins/git4idea/tests/git4idea/repo/GitRepositoryReaderTest.java
index 5baa95ba9d70..09f3977d7f7e 100644
--- a/plugins/git4idea/tests/git4idea/repo/GitRepositoryReaderTest.java
+++ b/plugins/git4idea/tests/git4idea/repo/GitRepositoryReaderTest.java
@@ -140,7 +140,7 @@ public class GitRepositoryReaderTest extends GitPlatformTest {
@Test
public void testBranches() throws Exception {
- Collection remotes = GitConfig.read(myPlatformFacade, new File(myGitDir, "config")).parseRemotes();
+ Collection remotes = GitConfig.read(new File(myGitDir, "config")).parseRemotes();
GitBranchState state = myRepositoryReader.readState(remotes);
assertEquals("HEAD revision is incorrect", readHead(myTempDir), state.getCurrentRevision());
diff --git a/plugins/git4idea/tests/git4idea/test/GitPlatformTest.kt b/plugins/git4idea/tests/git4idea/test/GitPlatformTest.kt
index 5bfe6fa012ac..e2ac23deb0a8 100644
--- a/plugins/git4idea/tests/git4idea/test/GitPlatformTest.kt
+++ b/plugins/git4idea/tests/git4idea/test/GitPlatformTest.kt
@@ -23,7 +23,6 @@ import com.intellij.openapi.vcs.*
import com.intellij.testFramework.vcs.AbstractVcsTestCase
import com.intellij.vcs.test.VcsPlatformTest
import git4idea.DialogManager
-import git4idea.GitPlatformFacade
import git4idea.GitUtil
import git4idea.GitVcs
import git4idea.commands.Git
@@ -37,7 +36,6 @@ abstract class GitPlatformTest : VcsPlatformTest() {
protected lateinit var myGitRepositoryManager: GitRepositoryManager
protected lateinit var myGitSettings: GitVcsSettings
- protected lateinit var myPlatformFacade: GitPlatformFacade
protected lateinit var myGit: TestGitImpl
protected lateinit var myVcs: GitVcs
protected lateinit var myDialogManager: TestDialogManager
@@ -54,7 +52,6 @@ abstract class GitPlatformTest : VcsPlatformTest() {
myVcsNotifier = ServiceManager.getService(myProject, VcsNotifier::class.java) as TestVcsNotifier
myGitRepositoryManager = GitUtil.getRepositoryManager(myProject)
- myPlatformFacade = ServiceManager.getService(myProject, GitPlatformFacade::class.java)
myGit = GitTestUtil.overrideService(Git::class.java, TestGitImpl::class.java)
myVcs = GitVcs.getInstance(myProject)!!
myVcs.doActivate()
diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java b/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java
index 71d6910fe17a..7705e6ebc3da 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java
@@ -26,7 +26,6 @@ import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
-import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
import git4idea.actions.BasicAction;
import git4idea.commands.*;
@@ -223,11 +222,10 @@ public class GithubRebaseAction extends DumbAwareAction {
@NotNull final GitRepository gitRepository,
@NotNull final ProgressIndicator indicator) {
final Git git = ServiceManager.getService(project, Git.class);
- final GitPlatformFacade facade = ServiceManager.getService(project, GitPlatformFacade.class);
AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
List rootsToSave = Collections.singletonList(gitRepository.getRoot());
- GitPreservingProcess process = new GitPreservingProcess(project, facade, git, rootsToSave, "Rebasing", "upstream/master",
+ GitPreservingProcess process = new GitPreservingProcess(project, git, rootsToSave, "Rebasing", "upstream/master",
GitVcsSettings.UpdateChangesPolicy.STASH, indicator,
() -> {
doRebaseCurrentBranch(project, gitRepository.getRoot(), indicator);