From ee81a2b9919f47f91db677b9ac984ed280a85c3b Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Wed, 8 Jul 2015 11:45:52 +0300 Subject: [PATCH] [git] remove unused methods around GitChangesSaver, correctly refresh after unstashing --- .../git4idea/src/git4idea/stash/GitChangesSaver.java | 12 ------------ .../src/git4idea/stash/GitShelveChangesSaver.java | 6 ------ .../src/git4idea/stash/GitStashChangesSaver.java | 9 ++------- .../src/git4idea/update/GitUpdateProcess.java | 5 ----- 4 files changed, 2 insertions(+), 30 deletions(-) diff --git a/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java b/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java index 958bd85f1cee..caa151eff7b0 100644 --- a/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java +++ b/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java @@ -53,11 +53,6 @@ public abstract class GitChangesSaver { protected GitConflictResolver.Params myParams; - /** - * Refreshes files changed during save or load. - */ - public abstract void refresh(); - /** * Returns an instance of the proper GitChangesSaver depending on the given save changes policy. * @return {@link GitStashChangesSaver} or {@link GitShelveChangesSaver}. @@ -96,13 +91,6 @@ public abstract class GitChangesSaver { save(rootsToSave); } - /** - * Loads local changes from stash or shelf, and sorts the changes back to the change lists they were before update. - */ - public void restoreLocalChanges() { - load(); - } - public void notifyLocalChangesAreNotRestored() { if (wereChangesSaved()) { LOG.info("Update is incomplete, changes are not restored"); diff --git a/plugins/git4idea/src/git4idea/stash/GitShelveChangesSaver.java b/plugins/git4idea/src/git4idea/stash/GitShelveChangesSaver.java index 812df757cb30..6fb27dd835e9 100644 --- a/plugins/git4idea/src/git4idea/stash/GitShelveChangesSaver.java +++ b/plugins/git4idea/src/git4idea/stash/GitShelveChangesSaver.java @@ -112,10 +112,4 @@ public class GitShelveChangesSaver extends GitChangesSaver { protected void showSavedChanges() { myShelveViewManager.activateView(myShelvedLists.get(myShelvedLists.keySet().iterator().next())); } - - @Override - public void refresh() { - // refreshed inside shelve manager - } - } diff --git a/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java b/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java index 55f348944bcc..6ed8bc20e59e 100644 --- a/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java +++ b/plugins/git4idea/src/git4idea/stash/GitStashChangesSaver.java @@ -26,7 +26,7 @@ import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vcs.history.VcsRevisionNumber; import com.intellij.openapi.vcs.impl.LocalChangesUnderRoots; import com.intellij.openapi.vcs.merge.MergeDialogCustomizer; -import com.intellij.openapi.vfs.LocalFileSystem; +import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import git4idea.GitPlatformFacade; import git4idea.commands.Git; @@ -92,12 +92,6 @@ public class GitStashChangesSaver extends GitChangesSaver { GitUnstashDialog.showUnstashDialog(myProject, new ArrayList(myStashedRoots), myStashedRoots.iterator().next()); } - @Override - public void refresh() { - // we'll refresh more but this way we needn't compute what files under roots etc - LocalFileSystem.getInstance().refreshIoFiles(myChangeManager.getAffectedPaths()); - } - private void stash(Collection roots) throws VcsException { for (VirtualFile root : roots) { final String message = GitHandlerUtil.formatOperationName("Stashing changes from", root); @@ -131,6 +125,7 @@ public class GitStashChangesSaver extends GitChangesSaver { GitSimpleEventDetector conflictDetector = new GitSimpleEventDetector(GitSimpleEventDetector.Event.MERGE_CONFLICT_ON_UNSTASH); GitCommandResult result = myGit.stashPop(repository, conflictDetector); + VfsUtil.markDirtyAndRefresh(false, true, false, root); if (result.success()) { return false; } diff --git a/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java b/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java index a146cfaa0741..1c5eb8c73dc1 100644 --- a/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java +++ b/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java @@ -304,11 +304,6 @@ public class GitUpdateProcess { return compoundResult.join(result); } - private void restoreLocalChanges() { - mySaver.restoreLocalChanges(); - mySaver.refresh(); - } - // fetch all roots. If an error happens, return false and notify about errors. private boolean fetchAndNotify() { return new GitFetcher(myProject, myProgressIndicator, false).fetchRootsAndNotify(myRepositories, "Update failed", false);