diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/OpenIdeDependenciesModule.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/OpenIdeDependenciesModule.java index b106f033..89d481b2 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/OpenIdeDependenciesModule.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/OpenIdeDependenciesModule.java @@ -27,7 +27,6 @@ import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFileManager; -import git4idea.GitPlatformFacade; import git4idea.commands.Git; /** @@ -49,7 +48,6 @@ protected void configure() { bind(LocalFileSystem.class).toInstance(LocalFileSystem.getInstance()); bind(Git.class).toInstance(ServiceManager.getService(Git.class)); - bind(GitPlatformFacade.class).toInstance(ServiceManager.getService(GitPlatformFacade.class)); bind(FileDocumentManager.class).toInstance(FileDocumentManager.getInstance()); bind(VirtualFileManager.class).toInstance(VirtualFileManager.getInstance()); diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/git/GerritGitUtil.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/git/GerritGitUtil.java index 70e07d14..5e2a6a04 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/git/GerritGitUtil.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/git/GerritGitUtil.java @@ -31,6 +31,7 @@ import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.VcsException; +import com.intellij.openapi.vcs.changes.ChangeListManagerImpl; import com.intellij.openapi.vcs.history.VcsRevisionNumber; import com.intellij.openapi.vcs.merge.MergeDialogCustomizer; import com.intellij.openapi.vfs.VirtualFile; @@ -77,8 +78,6 @@ public class GerritGitUtil { @Inject private Git git; @Inject - private GitPlatformFacade platformFacade; - @Inject private FileDocumentManager fileDocumentManager; @Inject private Application application; @@ -157,7 +156,7 @@ public void run(@NotNull ProgressIndicator indicator) { public void cherryPickChange(final Project project, final ChangeInfo changeInfo, final String revisionId) { fileDocumentManager.saveAllDocuments(); - platformFacade.getChangeListManager(project).blockModalNotifications(); + ChangeListManagerImpl.getInstanceImpl(project).blockModalNotifications(); new Task.Backgroundable(project, "Cherry-picking...", false) { public void run(@NotNull ProgressIndicator indicator) { @@ -166,19 +165,19 @@ public void run(@NotNull ProgressIndicator indicator) { if (!gitRepositoryOptional.isPresent()) return; GitRepository gitRepository = gitRepositoryOptional.get(); - final VirtualFile virtualFile = gitRepository.getGitDir(); + final VirtualFile virtualFile = gitRepository.getRoot(); final String notLoaded = "Not loaded"; VcsUser notLoadedUser = new VcsUserImpl(notLoaded, notLoaded); VcsShortCommitDetails gitCommit = new VcsShortCommitDetailsImpl( HashImpl.build(revisionId), Collections.emptyList(), 0, virtualFile, notLoaded, notLoadedUser, notLoadedUser, 0); - cherryPick(gitRepository, gitCommit, git, platformFacade, project); + cherryPick(gitRepository, gitCommit, git, project); } finally { application.invokeLater(new Runnable() { public void run() { virtualFileManager.syncRefresh(); - platformFacade.getChangeListManager(project).unblockModalNotifications(); + ChangeListManagerImpl.getInstanceImpl(project).unblockModalNotifications(); } }); } @@ -190,7 +189,7 @@ public void run() { * A lot of this code is based on: git4idea.cherrypick.GitCherryPicker#cherryPick() (which is private) */ private boolean cherryPick(@NotNull GitRepository repository, @NotNull VcsShortCommitDetails commit, - @NotNull Git git, @NotNull GitPlatformFacade platformFacade, @NotNull Project project) { + @NotNull Git git, @NotNull Project project) { GitSimpleEventDetector conflictDetector = new GitSimpleEventDetector(CHERRY_PICK_CONFLICT); GitSimpleEventDetector localChangesOverwrittenDetector = new GitSimpleEventDetector(LOCAL_CHANGES_OVERWRITTEN_BY_CHERRY_PICK); GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector = @@ -200,7 +199,7 @@ private boolean cherryPick(@NotNull GitRepository repository, @NotNull VcsShortC if (result.success()) { return true; } else if (conflictDetector.hasHappened()) { - return new CherryPickConflictResolver(project, git, platformFacade, repository.getRoot(), + return new CherryPickConflictResolver(project, git, repository.getRoot(), commit.getId().toShortString(), commit.getAuthor().getName(), commit.getSubject()).merge(); } else if (untrackedFilesDetector.wasMessageDetected()) { @@ -228,9 +227,9 @@ private boolean cherryPick(@NotNull GitRepository repository, @NotNull VcsShortC */ private static class CherryPickConflictResolver extends GitConflictResolver { - public CherryPickConflictResolver(@NotNull Project project, @NotNull Git git, @NotNull GitPlatformFacade facade, @NotNull VirtualFile root, + public CherryPickConflictResolver(@NotNull Project project, @NotNull Git git, @NotNull VirtualFile root, @NotNull String commitHash, @NotNull String commitAuthor, @NotNull String commitMessage) { - super(project, git, facade, Collections.singleton(root), makeParams(commitHash, commitAuthor, commitMessage)); + super(project, git, Collections.singleton(root), makeParams(commitHash, commitAuthor, commitMessage)); } private static Params makeParams(String commitHash, String commitAuthor, String commitMessage) { diff --git a/src/test/java/com/urswolfer/intellij/plugin/gerrit/rest/GerritTestModule.java b/src/test/java/com/urswolfer/intellij/plugin/gerrit/rest/GerritTestModule.java index d7b8f8f3..45fe80bd 100644 --- a/src/test/java/com/urswolfer/intellij/plugin/gerrit/rest/GerritTestModule.java +++ b/src/test/java/com/urswolfer/intellij/plugin/gerrit/rest/GerritTestModule.java @@ -33,7 +33,6 @@ import com.urswolfer.intellij.plugin.gerrit.GerritModule; import com.urswolfer.intellij.plugin.gerrit.GerritSettings; import com.urswolfer.intellij.plugin.gerrit.OpenIdeDependenciesModule; -import git4idea.GitPlatformFacade; import git4idea.commands.Git; import org.easymock.EasyMock; @@ -62,7 +61,6 @@ protected void installOpenIdeDependenciesModule() { bindMock(LocalFileSystem.class); bindMock(Git.class); - bindMock(GitPlatformFacade.class); bindMock(FileDocumentManager.class); bindMock(VirtualFileManager.class);