git: get rid of GitPlatformFacade as not valuable anymore
authorKirill Likhodedov <Kirill.Likhodedov@jetbrains.com>
Mon, 2 May 2016 12:31:30 +0000 (15:31 +0300)
committerKirill Likhodedov <Kirill.Likhodedov@jetbrains.com>
Mon, 2 May 2016 13:16:11 +0000 (16:16 +0300)
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.

57 files changed:
platform/dvcs-impl/src/com/intellij/dvcs/DvcsPlatformFacade.java [deleted file]
platform/dvcs-impl/src/com/intellij/dvcs/DvcsPlatformFacadeImpl.java [deleted file]
plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/CloudGitDeploymentRuntime.java
plugins/git4idea/src/git4idea/GitPlatformFacade.java
plugins/git4idea/src/git4idea/GitPlatformFacadeImpl.java
plugins/git4idea/src/git4idea/actions/GitStash.java
plugins/git4idea/src/git4idea/branch/GitBranchIsNotFullyMergedDialog.java
plugins/git4idea/src/git4idea/branch/GitBranchOperation.java
plugins/git4idea/src/git4idea/branch/GitBranchUiHandlerImpl.java
plugins/git4idea/src/git4idea/branch/GitBranchWorker.java
plugins/git4idea/src/git4idea/branch/GitBrancherImpl.java
plugins/git4idea/src/git4idea/branch/GitCheckoutNewBranchOperation.java
plugins/git4idea/src/git4idea/branch/GitCheckoutOperation.java
plugins/git4idea/src/git4idea/branch/GitDeleteBranchOperation.java
plugins/git4idea/src/git4idea/branch/GitDeleteRemoteBranchOperation.java
plugins/git4idea/src/git4idea/branch/GitMergeOperation.java
plugins/git4idea/src/git4idea/branch/GitRenameBranchOperation.java
plugins/git4idea/src/git4idea/branch/GitSmartOperationDialog.java
plugins/git4idea/src/git4idea/checkin/GitCheckinHandlerFactory.java
plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java
plugins/git4idea/src/git4idea/crlf/GitCrlfProblemsDetector.java
plugins/git4idea/src/git4idea/log/GitShowExternalLogAction.java
plugins/git4idea/src/git4idea/merge/GitConflictResolver.java
plugins/git4idea/src/git4idea/merge/GitMergeCommittingConflictResolver.java
plugins/git4idea/src/git4idea/push/GitPushOperation.java
plugins/git4idea/src/git4idea/rebase/GitAbortRebaseProcess.java
plugins/git4idea/src/git4idea/rebase/GitRebaseProcess.java
plugins/git4idea/src/git4idea/rebase/GitRebaseSpec.java
plugins/git4idea/src/git4idea/rebase/GitRebaser.java
plugins/git4idea/src/git4idea/repo/GitConfig.java
plugins/git4idea/src/git4idea/repo/GitRemote.java
plugins/git4idea/src/git4idea/repo/GitRepositoryCreator.java
plugins/git4idea/src/git4idea/repo/GitRepositoryImpl.java
plugins/git4idea/src/git4idea/repo/GitRepositoryManager.java
plugins/git4idea/src/git4idea/reset/GitResetOperation.java
plugins/git4idea/src/git4idea/stash/GitChangesSaver.java
plugins/git4idea/src/git4idea/stash/GitShelveChangesSaver.java
plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java
plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java
plugins/git4idea/src/git4idea/ui/branch/GitLogBranchOperationsActionGroup.java
plugins/git4idea/src/git4idea/update/GitMergeUpdater.java
plugins/git4idea/src/git4idea/update/GitUpdateEnvironment.java
plugins/git4idea/src/git4idea/update/GitUpdateProcess.java
plugins/git4idea/src/git4idea/util/GitFreezingProcess.java
plugins/git4idea/src/git4idea/util/GitPreservingProcess.java
plugins/git4idea/test-stepdefs/git4idea/GitAddSteps.java
plugins/git4idea/test-stepdefs/git4idea/GitCherryPickStepdefs.java
plugins/git4idea/test-stepdefs/git4idea/GitCucumberWorld.java
plugins/git4idea/tests/git4idea/branch/GitBranchWorkerTest.java
plugins/git4idea/tests/git4idea/crlf/GitCrlfProblemsDetectorTest.java
plugins/git4idea/tests/git4idea/rebase/GitMultiRepoRebaseTest.kt
plugins/git4idea/tests/git4idea/rebase/GitSingleRepoRebaseTest.kt
plugins/git4idea/tests/git4idea/repo/GitConfigTest.java
plugins/git4idea/tests/git4idea/repo/GitRepositoryReaderNewTest.kt
plugins/git4idea/tests/git4idea/repo/GitRepositoryReaderTest.java
plugins/git4idea/tests/git4idea/test/GitPlatformTest.kt
plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.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 (file)
index 91adfa2..0000000
+++ /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:
- * <pre>
- *   ModuleManager.getInstance(project).getModules()
- * </pre>
- * 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.
- * <p/>
- * This interface is intended to encapsulate access to the underlying IntelliJ functionality.
- * <p/>
- * 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> T runReadAction(@NotNull Computable<T> 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 (file)
index 307b605..0000000
+++ /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> T runReadAction(@NotNull Computable<T> 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);
-  }
-
-}
index 86fe721c8a1ee4fd39fc9af8ff96143f8ee0b409..eabb0aeaa2ea20114c0350d7d9b483bab107066d 100644 (file)
@@ -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
index 450936045fd7f0257448ddce95e12942e9999c48..c11d19738712c088109da0b97303c94250a287d8 100644 (file)
  */
 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 extends RepositoryManager<GitRepository>> 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);
 }
index 24b0d5387b72a79f4b4526ee49c4cecaedb42405..608dab12ecca517febe6304e9a9082f1f9a45079 100644 (file)
  */
 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);
   }
 }
index 7c9540ebe344480660f83e62791bc5da9131b7c8..cf1514c8069cb1fc6a613669d065904200236b70 100644 (file)
@@ -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);
   }
 
   /**
index 56d98305ba10a88361859a89625a1d08dd6bc37d..f85177c1f96542e81372f16712a7768430233930 100644 (file)
@@ -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<String> 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();
   }
 
index f43d131224007d3cf345a89de21a49790cb7d2b1..ab843baa72e30dc9d11af0a594a29ccdfdbb853f 100644 (file)
@@ -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<GitRepository> myRepositories;
   @NotNull protected final Map<GitRepository, String> myCurrentHeads;
-  private final GitVcsSettings mySettings;
+  @NotNull private final GitVcsSettings mySettings;
 
   @NotNull private final Collection<GitRepository> mySuccessfulRepositories;
   @NotNull private final Collection<GitRepository> mySkippedRepositories;
   @NotNull private final Collection<GitRepository> 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<GitRepository> repositories) {
     myProject = project;
-    myFacade = facade;
     myGit = git;
     myUiHandler = uiHandler;
     myRepositories = repositories;
@@ -79,7 +81,7 @@ abstract class GitBranchOperation {
     mySuccessfulRepositories = new ArrayList<GitRepository>();
     mySkippedRepositories = new ArrayList<GitRepository>();
     myRemainingRepositories = new ArrayList<GitRepository>(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) {
index 309a3e911ac8b863434f54b514f728bd0c46b3a7..14cb1ebcd4625725e43ad62d3eb273b50c9a5e91 100644 (file)
@@ -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();
           }
         }
       }
index 64e0482d3b9ca6e83ffeb645e8d3720ac72ff4aa..2e4eadf4523eff8827f87d40c7453a24fb92a726 100644 (file)
@@ -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<GitRepository> 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<GitRepository> 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<GitRepository> 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<GitRepository> 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<GitRepository> repositories, @NotNull String branchName) {
@@ -134,7 +129,7 @@ public final class GitBranchWorker {
 
   public void renameBranch(@NotNull String currentName, @NotNull String newName, @NotNull List<GitRepository> 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<GitRepository> repositories,
index 3ac8293a42bf5a58d5bf16b943593a32761ec6f4..e05cac19eacf1bc98271bd737439d7998f31584c 100644 (file)
@@ -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
index 397ddf3e9b771e2a1200ed9d0d37f33f03956e3a..59144434d074bc78c2939f554cc83ad7476e26fa 100644 (file)
@@ -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<GitRepository> repositories, @NotNull String newBranchName) {
-    super(project, facade, git, uiHandler, repositories);
+    super(project, git, uiHandler, repositories);
     myNewBranchName = newBranchName;
     myProject = project;
   }
index 9cf1995cb5e05e8b2498ab67315eb399e0b1e7ad..46cd668d83a63a6f48dadd46180685bf7b17282f 100644 (file)
@@ -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<GitRepository> 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<GitRepository> 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() {
index 1dba1e07f6acf6cabdc13fd9aabd93298a9a487f..b7ea81dfb061440c1356e39883176fcac7bdb21a 100644 (file)
@@ -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<GitRepository> repositories, @NotNull String branchName) {
-    super(project, facade, git, uiHandler, repositories);
+    super(project, git, uiHandler, repositories);
     myBranchName = branchName;
   }
 
index 82b7580cd6fafbefd27f0c33b535290f6af16386..f25d6aee15b5deb54e5d46aef596bce46fe47fbb 100644 (file)
@@ -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<GitRepository> 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
index fad235ea4ca92ac580e9ab2ad19220bf31e62a02..19eb1517e1f5b1e2a46aa286d18a86776262398c 100644 (file)
@@ -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<GitRepository, Boolean> myConflictedRepositories = new HashMap<GitRepository, Boolean>();
   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<GitRepository> repositories,
                     @NotNull String branchToMerge, GitBrancher.DeleteOnMergeOption deleteOnMerge,
                     @NotNull Map<GitRepository, String> 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<GitRepository> 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<VirtualFile> 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));
index 0faf227f760faa7101e8571245f6b2fe3027a0dd..749ac1c4b9d215f0e0e58bbba22769fb29050e83 100644 (file)
@@ -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<GitRepository> repositories) {
-    super(project, facade, git, uiHandler, repositories);
+    super(project, git, uiHandler, repositories);
     myCurrentName = currentName;
     myNewName = newName;
     myNotifier = VcsNotifier.getInstance(myProject);
index 4f50730276248eb8f144dc6fe864dcd351bc26da..3978cc89e8e4c4070bd35d496ddc2433257c5bd0 100644 (file)
 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());
       }
     });
index 281dcb1172471ff3dc08c9e0e63792bdf469d385..a9483bfb266744f6c1965bdd8d49116772335d05 100644 (file)
@@ -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<VirtualFile> 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));
           }
         });
 
index 5a4f9597dec1a67a0290875dc248a8bda5d7b4d2..3b8cc082c2bf0d457f6444f0c6657d458bed178e 100644 (file)
@@ -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<VcsFullCommitDetails> commits) {
-    Map<GitRepository, List<VcsFullCommitDetails>> commitsInRoots =
-      DvcsUtil.<GitRepository>groupCommitsByRoots(myPlatformFacade.getRepositoryManager(myProject), commits);
+    Map<GitRepository, List<VcsFullCommitDetails>> commitsInRoots = DvcsUtil.groupCommitsByRoots(myRepositoryManager, commits);
     LOG.info("Cherry-picking commits: " + toString(commitsInRoots));
     List<GitCommitWrapper> successfulCommits = ContainerUtil.newArrayList();
     List<GitCommitWrapper> 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<GitCommitWrapper> 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<LocalChangeList> changeList = new AtomicReference<LocalChangeList>();
-    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<Change> 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();
         }
       }
     }
index 68bb3a11578f1d042fe90f7793864f1b126fed42..8568ad027bbf144c4732d2f199d27eb64be5b55e 100644 (file)
 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<VirtualFile> files) {
-    return new GitCrlfProblemsDetector(project, platformFacade, git, files);
+  public static GitCrlfProblemsDetector detect(@NotNull Project project, @NotNull Git git, @NotNull Collection<VirtualFile> 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<VirtualFile> files) {
     myProject = project;
-    myPlatformFacade = platformFacade;
+    myRepositoryManager = GitUtil.getRepositoryManager(project);
     myGit = git;
 
     Map<VirtualFile, List<VirtualFile>> filesByRoots = sortFilesByRoots(files);
@@ -101,7 +101,7 @@ public class GitCrlfProblemsDetector {
 
   @NotNull
   private Collection<VirtualFile> findFilesWithoutAttrs(@NotNull VirtualFile root, @NotNull Collection<VirtualFile> 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<VirtualFile> filesWithCrlf = new ArrayList<VirtualFile>();
     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;
index 2b0e516bbacba83cca110bcf18908a3c6d08fbdf..16deabacab917ed4c159ad547c7baa821a1213a9 100644 (file)
@@ -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<VirtualFile> 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));
     }
index e95b496867784dc228b3160bed07102965e25ba8..df2a9b6c6709f4fff3f9fffa65b74db81aefe4b1 100644 (file)
@@ -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<VirtualFile> myRoots;
+  @NotNull private final Params myParams;
+
   @NotNull protected final Project myProject;
   @NotNull private final Git myGit;
-  @NotNull private final GitPlatformFacade myPlatformFacade;
-  private final Collection<VirtualFile> 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<VirtualFile> roots, @NotNull Params params) {
+    this(project, git, roots, params);
+  }
+
+  public GitConflictResolver(@NotNull Project project, @NotNull Git git, @NotNull Collection<VirtualFile> 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);
       }
     }
index 302c889ac16fbd8a7b18b87167de17be8748cde2..788f94d7f093eb1f5b0d8c979e15c80c54073e6f 100644 (file)
  */
 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<VirtualFile> 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;
index eff449da6f58525d662beb2a725b3417c58b5bed..9dca5a727ed117784ed0de14804ab8f1625b8e08 100644 (file)
@@ -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<GitRepository, GitRevisionNumber> currentHeads = ContainerUtil.newHashMap();
@@ -437,7 +435,7 @@ public class GitPushOperation {
   protected GitUpdateResult update(@NotNull Collection<GitRepository> rootsToUpdate,
                                    @NotNull UpdateMethod updateMethod,
                                    boolean checkForRebaseOverMergeProblem) {
-    GitUpdateResult updateResult = new GitUpdateProcess(myProject, myPlatformFacade, myProgressIndicator,
+    GitUpdateResult updateResult = new GitUpdateProcess(myProject, myProgressIndicator,
                                                         new HashSet<GitRepository>(rootsToUpdate), UpdatedFiles.create(),
                                                         checkForRebaseOverMergeProblem).update(updateMethod);
     for (GitRepository repository : rootsToUpdate) {
index 958ef07298ef9cca68542ca560d9bcb52629a6bb..492aefe546bc18fb903b57a93b8af6214299b943 100644 (file)
@@ -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<GitRepository> repositoriesToRefresh = ContainerUtil.newArrayList();
index 0af72afff74fbd1cee54c72c2fe10f6202320d94..adb373b302ca5b88f4c33658ba6e8940ab7226e2 100644 (file)
@@ -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;
     }
 
index d31b138e63ce2c00acc1f39c377e81d27fd06f71..6839cb7095b68259a5c543eac7e9b98d94bbc1ca 100644 (file)
@@ -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
index c5669f09095fcf8039d5359a116b576c855c7802..183ff3031d8a7b20ab3fb61f8b2a980d72cd6648 100644 (file)
@@ -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;
     }
index fc35665e2f9d738162ba714a07077778bd47579f..bb5acb44a6c99d7e56a0b63a97f23a5d4ac635b6 100644 (file)
@@ -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.<Remote>emptyList(), Collections.<Url>emptyList(),
                                           Collections.<BranchConfig>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();
index c30326397149680167656775142ab0bcbd3718cb..cb5de098b72154acfd03dbbd6cea21b45a2799b0 100644 (file)
@@ -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.<base>.insteadOf}.
  * </p>
  * <p>
- *   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. <br/>
  *   This is made to avoid urls transformation logic from the code using GitRemote, leaving it all in GitConfig parsing.
index 551f14f4c322102d5449ab542f8e193b7ea27ca1..ca3ba1b8f7e4d675c54e0fd2f1b90210756eb5b7 100644 (file)
@@ -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
index bc099f612bd8c2834a23b60819c3ce46970b9355..5982a1e202ee6681b7c27c09a6e90e3befa7247d 100644 (file)
@@ -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<GitRemote> remotes = config.parseRemotes();
     GitBranchState state = myReader.readState(remotes);
     Collection<GitBranchTrackInfo> trackInfos = config.parseTrackInfos(state.getLocalBranches().keySet(), state.getRemoteBranches().keySet());
index e72f8b8bb2c1ed5f5f3c4c3b609e401038972868..1900142360a743f1d6550b04a7a9bed647194671 100644 (file)
@@ -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;
 
-public class GitRepositoryManager extends AbstractRepositoryManager<GitRepository> {
+import static com.intellij.util.ObjectUtils.assertNotNull;
 
-  @NotNull private final GitPlatformFacade myPlatformFacade;
-  @NotNull private final Project myProject;
+public class GitRepositoryManager extends AbstractRepositoryManager<GitRepository> {
 
+  @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
index 5b6b3f8a6658cd09ada73c2fd60db9184954ec47..7c069524f83ee5ae875018d3cc1d66a4bd1f15b6 100644 (file)
@@ -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<GitRepository, VcsFullCommitDetails> 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<GitCommandResult> 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
index b415048fc5f3d389df8076a78fd5144da94bc6d3..70f4a99dc5146f884ead2dbd682d531981e8df3b 100644 (file)
@@ -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);
   }
 
   /**
index 6727c7a23481926631d1fc42802a322bfa3b8039..abec770e263c14d79c6df6cc9c9224f5ed685545 100644 (file)
@@ -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<String, ShelvedChangeList> 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<VirtualFile> rootsToSave) throws VcsException {
     LOG.info("save " + rootsToSave);
     final Map<String, Map<VirtualFile, Collection<Change>>> 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"));
index 0d91e388d846caea6ef40efc44a97e46bfc27136..921a2e29823d0c3b225fcfeec26186aa186a818c 100644 (file)
@@ -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<VirtualFile> 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<VirtualFile> myStashedRoots;
 
-    public UnstashConflictResolver(@NotNull Project project, GitPlatformFacade platformFacade, @NotNull Git git,
+    public UnstashConflictResolver(@NotNull Project project, @NotNull Git git,
                                    @NotNull Set<VirtualFile> stashedRoots, @Nullable Params params) {
-      super(project, git, platformFacade, stashedRoots, makeParamsOrUse(params));
+      super(project, git, stashedRoots, makeParamsOrUse(params));
       myStashedRoots = stashedRoots;
     }
 
index 9be52ed5cf571ed029ba82b4b8bef2ad4a372483..fdf416341c8049ddb8a9e9e2d137282eef1b9f70 100644 (file)
@@ -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;
index e4aa432eb6fea095fdfb6d7691db8c33925bbe47..9b0ef8ace06b8156e990f1520044e8b8103a4812 100644 (file)
@@ -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<AnAction> branchActionGroups = new ArrayList<AnAction>();
index 38b5505fdc272348acf12d6a274ea9a7fd928ca9..acf5418663affcd725c170a13df9177b13b17e17 100644 (file)
@@ -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;
     }
index b7903cc2b719502456a03d8011cc5c317023235f..f2ad35e42ac817257827e8f991929fa8103ceab0 100644 (file)
@@ -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<SequentialUpdatesContext> sequentialUpdatesContextRef) throws ProcessCanceledException {
     Set<VirtualFile> 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();
index 741918c6c1ece0f1d1da1f65494cc02b27cee537..a88b250cab5c760174fa169a3948ea57ab3543d7 100644 (file)
@@ -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<GitRepository> myRepositories;
   private final boolean myCheckRebaseOverMergeProblem;
   private final UpdatedFiles myUpdatedFiles;
@@ -78,13 +76,11 @@ public class GitUpdateProcess {
   private final Map<VirtualFile, GitBranchPair> myTrackedBranches = new HashMap<VirtualFile, GitBranchPair>();
 
   public GitUpdateProcess(@NotNull Project project,
-                          @NotNull GitPlatformFacade platformFacade,
                           @Nullable ProgressIndicator progressIndicator,
                           @NotNull Collection<GitRepository> 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<GitUpdateResult> compoundResult = Ref.create();
     final Map<VirtualFile, GitUpdater> 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 <b>continue rebase</b>. <br/> You also may <b>abort rebase</b> 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);
       }
index 2fe82b5ab087437e858f384b0d1f17f3f44d4d1f..d2202d791d7d4bddfe9e9723ec5cdf4f49b7a311 100644 (file)
  */
 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 Application myApplication;
   @NotNull private final ChangeListManagerEx myChangeListManager;
+  @NotNull private final ProjectManagerEx myProjectManager;
+  @NotNull private final SaveAndSyncHandler mySaveAndSyncHandler;
 
-  public GitFreezingProcess(@NotNull Project project, @NotNull GitPlatformFacade facade,
-                            @NotNull String operationTitle, @NotNull Runnable runnable) {
-    myFacade = facade;
+  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() {
index 93e472baae2b6ce96a5f48380eb6e318e103e21b..649289f7cbd82ddc6b9e0e868c9578eb592fa78e 100644 (file)
@@ -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<VirtualFile> 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<VirtualFile> 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<VirtualFile> files) {
index 2c19f37183703d301c060b32138adc18fc1deb45..962fa5527ece3f4792a78f0dd568d7f59da0b89f 100644 (file)
@@ -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));
index 07661c0ecf02c69c34ad9d3ef3a45766cdf31e9b..7ec923537657531edc77527265d7f13292eb0199 100644 (file)
@@ -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<VcsFullCommitDetails> loadDetails(List<String> hashes, @NotNull VirtualFile root) throws VcsException {
index d2733b600b9bd627009ce5af2e5c71a39a74cbb3..05ac17a7fd8cd1d8aa4bebd78249e24564f4e4cf 100644 (file)
@@ -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<Future>();
index 2169231e747cdf79ae45540860660baa8e49dbed..1fecb221df39f0df6361cbd3b0af7c91c6bfe728 100644 (file)
@@ -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<Change> changes,
@@ -526,7 +526,7 @@ public class GitBranchWorkerTest extends GitPlatformTest {
     unmergedFiles(myCommunity);
 
     final Ref<Boolean> 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<Boolean> 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<GitRepository, List<GitCommit>> 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);
   }
 
index 4c8d2d41f5c8528827188a4a4c63e5e99f0052aa..2af33bf1a62f679a40dd530f8754591390209319 100644 (file)
@@ -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 {
index 2cc2664b8549cc8ffec4a9fc9bc269149b74eaee..919cd0d7a04a7ca8a60a41a8d556c292428ebf40 100644 (file)
@@ -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 }
index c3e115a4925d3fc259408a3bdc20a8c649bda551..59af0e076887a8087df06159e7303fba7907001a 100644 (file)
@@ -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`()
index d93e2e13b2e20e852739a983d8c0793007ce30db..29784a6e9ea251c3047c410682c44eb64a3e66eb 100644 (file)
@@ -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<GitRemote> remotes = GitConfig.read(myPlatformFacade, new File(gitDir, "config")).parseRemotes();
+    Collection<GitRemote> 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);
   }
 
index 5ab39996515bab6866fae98d36ef38dcd62195c2..98265ee86917c32d93db3a06d1149a3148d56b7e 100644 (file)
@@ -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)
index 5baa95ba9d70697a9ea2bff133d6cc90ed01eec3..09f3977d7f7e2c426c004d75cf70cd6802bfd6d3 100644 (file)
@@ -140,7 +140,7 @@ public class GitRepositoryReaderTest extends GitPlatformTest {
 
   @Test
   public void testBranches() throws Exception {
-    Collection<GitRemote> remotes = GitConfig.read(myPlatformFacade, new File(myGitDir, "config")).parseRemotes();
+    Collection<GitRemote> remotes = GitConfig.read(new File(myGitDir, "config")).parseRemotes();
     GitBranchState state = myRepositoryReader.readState(remotes);
 
     assertEquals("HEAD revision is incorrect", readHead(myTempDir), state.getCurrentRevision());
index 5bfe6fa012ac888ccd0f8cfc7d842ad19dc5c86b..e2ac23deb0a838e45264e0f793d15115f33be44a 100644 (file)
@@ -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()
index 71d6910fe17ada2adc7c54a7705ad2cc4ed651cd..7705e6ebc3da6bffaaafb6e2c71b4f27c4294450 100644 (file)
@@ -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<VirtualFile> 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);