Skip to content

Commit

Permalink
remove deprecated GitPlatformFacade usage
Browse files Browse the repository at this point in the history
- got deprecated in intellij commit d5223f0f78ff4279e2582965627d6373cbd9ce95
  • Loading branch information
uwolfer committed May 28, 2016
1 parent 36d0d9f commit 780046c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -77,8 +78,6 @@ public class GerritGitUtil {
@Inject
private Git git;
@Inject
private GitPlatformFacade platformFacade;
@Inject
private FileDocumentManager fileDocumentManager;
@Inject
private Application application;
Expand Down Expand Up @@ -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) {
Expand All @@ -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.<Hash>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();
}
});
}
Expand All @@ -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 =
Expand All @@ -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()) {
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -62,7 +61,6 @@ protected void installOpenIdeDependenciesModule() {
bindMock(LocalFileSystem.class);

bindMock(Git.class);
bindMock(GitPlatformFacade.class);
bindMock(FileDocumentManager.class);
bindMock(VirtualFileManager.class);

Expand Down

0 comments on commit 780046c

Please sign in to comment.