Git: move shelving from GitStashUtils to GitShelveUtils
authorKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Wed, 11 May 2011 09:18:44 +0000 (13:18 +0400)
committerKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Thu, 12 May 2011 07:39:37 +0000 (11:39 +0400)
plugins/git4idea/src/git4idea/checkout/branches/GitCheckoutProcess.java
plugins/git4idea/src/git4idea/stash/GitShelveChangesSaver.java
plugins/git4idea/src/git4idea/stash/GitShelveUtils.java [new file with mode: 0644]
plugins/git4idea/src/git4idea/stash/GitStashUtils.java

index b228b195f177628711af69eca30d8544b61091d1..c44a1deeafbb0d18cab7547a52fd176ccbcf781b 100644 (file)
@@ -44,7 +44,7 @@ import git4idea.checkout.branches.GitBranchConfigurations.BranchChanges;
 import git4idea.checkout.branches.GitBranchConfigurations.ChangeInfo;
 import git4idea.checkout.branches.GitBranchConfigurations.ChangeListInfo;
 import git4idea.commands.*;
-import git4idea.stash.GitStashUtils;
+import git4idea.stash.GitShelveUtils;
 import git4idea.ui.GitUIUtil;
 import org.jetbrains.annotations.Nullable;
 
@@ -591,52 +591,53 @@ public class GitCheckoutProcess {
     };
     continuation.addExceptionHandler(VcsException.class, exceptionConsumer);
     final GatheringContinuationContext initContext = new GatheringContinuationContext();
-    GitStashUtils.doSystemUnshelve(myProject, shelve, myShelveManager, new Runnable() {
-      @Override
-      public void run() {
-        final HashMap<Pair<String, String>, String> parsedChanges = new HashMap<Pair<String, String>, String>();
-        for (ChangeInfo changeInfo : changes.CHANGES) {
-          String before = changeInfo.BEFORE_PATH;
-          String after = changeInfo.AFTER_PATH;
-          parsedChanges.put(Pair.create(before, after), changeInfo.CHANGE_LIST_NAME);
-        }
-        try {
-          HashMap<String, LocalChangeList> lists = new HashMap<String, LocalChangeList>();
-          final List<LocalChangeList> existedChangeLists = myChangeManager.getChangeLists();
-          for (LocalChangeList localChangeList : existedChangeLists) {
-            lists.put(localChangeList.getName(), localChangeList);
-          }
-          LocalChangeList defaultList = myChangeManager.getDefaultChangeList();
-          for (ChangeListInfo changeListInfo : changes.CHANGE_LISTS) {
-            LocalChangeList changeList = lists.get(changeListInfo.NAME);
-            if (changeList == null) {
-              changeList = myChangeManager.addChangeList(changeListInfo.NAME, changeListInfo.COMMENT);
-              lists.put(changeListInfo.NAME, changeList);
-            }
-            if (changeListInfo.IS_DEFAULT) {
-              myChangeManager.setDefaultChangeList(changeList);
-            }
-          }
-          for (Change change : defaultList.getChanges()) {
-            ContentRevision beforeRevision = change.getBeforeRevision();
-            String before = beforeRevision == null ? null : beforeRevision.getFile().getPath();
-            ContentRevision afterRevision = change.getAfterRevision();
-            String after = afterRevision == null ? null : afterRevision.getFile().getPath();
-            Pair<String, String> key = Pair.create(before, after);
-            String listName = parsedChanges.get(key);
-            assert listName != null : "List name should be found: " + key;
-            if (!listName.equals(defaultList.getName())) {
-              LocalChangeList changeList = lists.get(listName);
-              assert changeList != null : "Change List should be found: " + listName;
-              myChangeManager.moveChangesTo(changeList, new Change[]{change});
-            }
-          }
-        }
-        catch (Throwable t) {
-         exceptionConsumer.consume(new VcsException(t));
-        }
-      }
-    }, initContext);
+    GitShelveUtils.doSystemUnshelve(myProject, shelve, myShelveManager, new Runnable() {
+                                      @Override
+                                      public void run() {
+                                        final HashMap<Pair<String, String>, String> parsedChanges =
+                                          new HashMap<Pair<String, String>, String>();
+                                        for (ChangeInfo changeInfo : changes.CHANGES) {
+                                          String before = changeInfo.BEFORE_PATH;
+                                          String after = changeInfo.AFTER_PATH;
+                                          parsedChanges.put(Pair.create(before, after), changeInfo.CHANGE_LIST_NAME);
+                                        }
+                                        try {
+                                          HashMap<String, LocalChangeList> lists = new HashMap<String, LocalChangeList>();
+                                          final List<LocalChangeList> existedChangeLists = myChangeManager.getChangeLists();
+                                          for (LocalChangeList localChangeList : existedChangeLists) {
+                                            lists.put(localChangeList.getName(), localChangeList);
+                                          }
+                                          LocalChangeList defaultList = myChangeManager.getDefaultChangeList();
+                                          for (ChangeListInfo changeListInfo : changes.CHANGE_LISTS) {
+                                            LocalChangeList changeList = lists.get(changeListInfo.NAME);
+                                            if (changeList == null) {
+                                              changeList = myChangeManager.addChangeList(changeListInfo.NAME, changeListInfo.COMMENT);
+                                              lists.put(changeListInfo.NAME, changeList);
+                                            }
+                                            if (changeListInfo.IS_DEFAULT) {
+                                              myChangeManager.setDefaultChangeList(changeList);
+                                            }
+                                          }
+                                          for (Change change : defaultList.getChanges()) {
+                                            ContentRevision beforeRevision = change.getBeforeRevision();
+                                            String before = beforeRevision == null ? null : beforeRevision.getFile().getPath();
+                                            ContentRevision afterRevision = change.getAfterRevision();
+                                            String after = afterRevision == null ? null : afterRevision.getFile().getPath();
+                                            Pair<String, String> key = Pair.create(before, after);
+                                            String listName = parsedChanges.get(key);
+                                            assert listName != null : "List name should be found: " + key;
+                                            if (!listName.equals(defaultList.getName())) {
+                                              LocalChangeList changeList = lists.get(listName);
+                                              assert changeList != null : "Change List should be found: " + listName;
+                                              myChangeManager.moveChangesTo(changeList, new Change[]{change});
+                                            }
+                                          }
+                                        }
+                                        catch (Throwable t) {
+                                          exceptionConsumer.consume(new VcsException(t));
+                                        }
+                                      }
+                                    }, initContext);
     continuation.run(initContext.getList());
   }
 
@@ -742,7 +743,7 @@ public class GitCheckoutProcess {
     if (progress != null) {
       progress.setText("Creating shelve: " + description);
     }
-    ShelvedChangeList shelved = GitStashUtils.shelveChanges(myProject, myShelveManager, toShelve, description, myExceptions);
+    ShelvedChangeList shelved = GitShelveUtils.shelveChanges(myProject, myShelveManager, toShelve, description, myExceptions);
     if (shelved == null) {
       return null;
     }
index 2e37e16df698f84580201eb62bb66184db0f079b..0dd56f9d70ab91bd0f7147fe5e7d0d2870b8feaf 100644 (file)
@@ -62,7 +62,7 @@ public class GitShelveChangesSaver extends GitChangesSaver {
       String oldProgressTitle = myProgressIndicator.getText();
       myProgressIndicator.setText(GitBundle.getString("update.shelving.changes"));
       List<VcsException> exceptions = new ArrayList<VcsException>(1);
-      myShelvedChangeList = GitStashUtils.shelveChanges(myProject, myShelveManager, changes, myStashMessage, exceptions);
+      myShelvedChangeList = GitShelveUtils.shelveChanges(myProject, myShelveManager, changes, myStashMessage, exceptions);
       myProgressIndicator.setText(oldProgressTitle);
       if (!exceptions.isEmpty()) {
         LOG.info("save " + exceptions, exceptions.get(0));
@@ -77,7 +77,7 @@ public class GitShelveChangesSaver extends GitChangesSaver {
       String oldProgressTitle = myProgressIndicator.getText();
       myProgressIndicator.setText(GitBundle.getString("update.unshelving.changes"));
       if (myShelvedChangeList != null) {
-        GitStashUtils.doSystemUnshelve(myProject, myShelvedChangeList, myShelveManager, restoreListsRunnable, context);
+        GitShelveUtils.doSystemUnshelve(myProject, myShelvedChangeList, myShelveManager, restoreListsRunnable, context);
       }
       myProgressIndicator.setText(oldProgressTitle);
     }
diff --git a/plugins/git4idea/src/git4idea/stash/GitShelveUtils.java b/plugins/git4idea/src/git4idea/stash/GitShelveUtils.java
new file mode 100644 (file)
index 0000000..6a9f766
--- /dev/null
@@ -0,0 +1,192 @@
+/*
+ * Copyright 2000-2011 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 git4idea.stash;
+
+import com.intellij.openapi.application.ModalityState;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.progress.AsynchronousExecution;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vcs.AbstractVcsHelper;
+import com.intellij.openapi.vcs.FilePath;
+import com.intellij.openapi.vcs.FileStatus;
+import com.intellij.openapi.vcs.VcsException;
+import com.intellij.openapi.vcs.changes.Change;
+import com.intellij.openapi.vcs.changes.ChangeListManager;
+import com.intellij.openapi.vcs.changes.InvokeAfterUpdateMode;
+import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
+import com.intellij.openapi.vcs.changes.shelf.ShelveChangesManager;
+import com.intellij.openapi.vcs.changes.shelf.ShelvedBinaryFile;
+import com.intellij.openapi.vcs.changes.shelf.ShelvedChange;
+import com.intellij.openapi.vcs.changes.shelf.ShelvedChangeList;
+import com.intellij.openapi.vfs.LocalFileSystem;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.util.continuation.ContinuationContext;
+import com.intellij.util.continuation.TaskDescriptor;
+import com.intellij.util.continuation.Where;
+import com.intellij.vcsUtil.VcsUtil;
+import git4idea.GitUtil;
+import git4idea.GitVcs;
+import git4idea.commands.GitFileUtils;
+import git4idea.vfs.GitVFSListener;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.event.ChangeEvent;
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * @author Kirill Likhodedov
+ */
+public class GitShelveUtils {
+  private static final Logger LOG = Logger.getInstance(GitShelveUtils.class.getName());
+
+  /**
+   * Perform system level unshelve operation
+   *
+   * @param project           the project
+   * @param shelvedChangeList the shelved change list
+   * @param shelveManager     the shelve manager
+   * @param restoreListsRunnable
+   */
+  @AsynchronousExecution
+  public static void doSystemUnshelve(final Project project,
+                                      final ShelvedChangeList shelvedChangeList,
+                                      final ShelveChangesManager shelveManager,
+                                      @NotNull final Runnable restoreListsRunnable,
+                                      final @NotNull ContinuationContext context) {
+    VirtualFile baseDir = project.getBaseDir();
+    assert baseDir != null;
+    final String projectPath = baseDir.getPath() + "/";
+
+    context.next(new TaskDescriptor("Refreshing files before unshelve", Where.POOLED) {
+        @Override
+        public void run(ContinuationContext context) {
+          LOG.info("doSystemUnshelve ");
+          // The changes are temporary copied to the first local change list, the next operation will restore them back
+          // Refresh files that might be affected by unshelve
+          refreshFilesBeforeUnshelve(shelvedChangeList, projectPath);
+
+          LOG.info("doSystemUnshelve files refreshed. unshelving in AWT thread.");
+        }
+      }, new TaskDescriptor("", Where.AWT) {
+        @Override
+        public void run(ContinuationContext context) {
+          GitVFSListener l = GitVcs.getInstance(project).getVFSListener();
+          l.setEventsSuppressed(true);
+
+          LOG.info("Unshelving in UI thread. shelvedChangeList: " + shelvedChangeList);
+          // we pass null as target change list for Patch Applier to do NOTHING with change lists
+          shelveManager.scheduleUnshelveChangeList(shelvedChangeList, shelvedChangeList.getChanges(),
+                                                   shelvedChangeList.getBinaryFiles(), null, false, context);
+        }
+      }, new TaskDescriptor("", Where.AWT) {
+      @Override
+      public void run(ContinuationContext context) {
+        GitVcs.getInstance(project).getVFSListener().setEventsSuppressed(false);
+        addFilesAfterUnshelve(project, shelvedChangeList, projectPath, context);
+        ChangeListManager.getInstance(project).invokeAfterUpdate(new Runnable() {
+            @Override
+            public void run() {
+              restoreListsRunnable.run();
+            }
+          }, InvokeAfterUpdateMode.BACKGROUND_NOT_CANCELLABLE_NOT_AWT, "Restoring changelists", ModalityState.NON_MODAL);
+      }
+    });
+  }
+
+  public static void addFilesAfterUnshelve(Project project,
+                                           ShelvedChangeList shelvedChangeList,
+                                           String projectPath, ContinuationContext context) {
+    Collection<FilePath> paths = new ArrayList<FilePath>();
+    for (ShelvedChange c : shelvedChangeList.getChanges()) {
+      if (c.getBeforePath() == null || !c.getBeforePath().equals(c.getAfterPath()) || c.getFileStatus() == FileStatus.ADDED) {
+        paths.add(VcsUtil.getFilePath(projectPath + c.getAfterPath()));
+      }
+    }
+    for (ShelvedBinaryFile f : shelvedChangeList.getBinaryFiles()) {
+      if (f.BEFORE_PATH == null || !f.BEFORE_PATH.equals(f.AFTER_PATH) || f.getFileStatus() == FileStatus.ADDED) {
+        paths.add(VcsUtil.getFilePath(projectPath + f.AFTER_PATH));
+      }
+    }
+    final VcsDirtyScopeManager dsm = VcsDirtyScopeManager.getInstance(project);
+    Map<VirtualFile, List<FilePath>> map = GitUtil.sortGitFilePathsByGitRoot(paths);
+    for (Map.Entry<VirtualFile, List<FilePath>> e : map.entrySet()) {
+      try {
+        GitFileUtils.addPaths(project, e.getKey(), e.getValue());
+        dsm.filePathsDirty(e.getValue(), null);
+      }
+      catch (VcsException e1) {
+        if (! context.handleException(e1)) {
+          AbstractVcsHelper.getInstance(project).showError(e1, "Can not add file to Git");
+          LOG.error("Vcs Exception not handled");
+        }
+      }
+    }
+  }
+
+  public static void refreshFilesBeforeUnshelve(ShelvedChangeList shelvedChangeList, String projectPath) {
+    HashSet<File> filesToRefresh = new HashSet<File>();
+    for (ShelvedChange c : shelvedChangeList.getChanges()) {
+      if (c.getBeforePath() != null) {
+        filesToRefresh.add(new File(projectPath + c.getBeforePath()));
+      }
+      if (c.getAfterPath() != null) {
+        filesToRefresh.add(new File(projectPath + c.getAfterPath()));
+      }
+    }
+    for (ShelvedBinaryFile f : shelvedChangeList.getBinaryFiles()) {
+      if (f.BEFORE_PATH != null) {
+        filesToRefresh.add(new File(projectPath + f.BEFORE_PATH));
+      }
+      if (f.AFTER_PATH != null) {
+        filesToRefresh.add(new File(projectPath + f.BEFORE_PATH));
+      }
+    }
+    LocalFileSystem.getInstance().refreshIoFiles(filesToRefresh);
+  }
+
+  /**
+   * Shelve changes
+   *
+   * @param project       the context project
+   * @param shelveManager the shelve manager
+   * @param changes       the changes to process
+   * @param description   the description of for the shelve
+   * @param exceptions    the generated exceptions
+   * @return created shelved change list or null in case failure
+   */
+  @Nullable
+  public static ShelvedChangeList shelveChanges(final Project project, final ShelveChangesManager shelveManager, Collection<Change> changes,
+                                                final String description,
+                                                final List<VcsException> exceptions) {
+    try {
+      ShelvedChangeList shelve = shelveManager.shelveChanges(changes, description);
+      project.getMessageBus().syncPublisher(ShelveChangesManager.SHELF_TOPIC).stateChanged(new ChangeEvent(GitStashUtils.class));
+      return shelve;
+    }
+    catch (IOException e) {
+      //noinspection ThrowableInstanceNeverThrown
+      exceptions.add(new VcsException("Shelving changes failed: " + description, e));
+      return null;
+    }
+    catch (VcsException e) {
+      exceptions.add(e);
+      return null;
+    }
+  }
+}
index 3bfc731c3109f45f33353a0dfc3dc887ae3b5c0b..89b3b8ca704c4d84e7681febb001cff696c9781c 100644 (file)
  */
 package git4idea.stash;
 
-import com.intellij.openapi.application.ModalityState;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.progress.AsynchronousExecution;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vcs.AbstractVcsHelper;
-import com.intellij.openapi.vcs.FilePath;
-import com.intellij.openapi.vcs.FileStatus;
 import com.intellij.openapi.vcs.VcsException;
-import com.intellij.openapi.vcs.changes.Change;
-import com.intellij.openapi.vcs.changes.ChangeListManager;
-import com.intellij.openapi.vcs.changes.InvokeAfterUpdateMode;
-import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
-import com.intellij.openapi.vcs.changes.shelf.ShelveChangesManager;
-import com.intellij.openapi.vcs.changes.shelf.ShelvedBinaryFile;
-import com.intellij.openapi.vcs.changes.shelf.ShelvedChange;
-import com.intellij.openapi.vcs.changes.shelf.ShelvedChangeList;
-import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.util.Consumer;
-import com.intellij.util.continuation.ContinuationContext;
-import com.intellij.util.continuation.TaskDescriptor;
-import com.intellij.util.continuation.Where;
-import com.intellij.vcsUtil.VcsUtil;
-import git4idea.GitUtil;
-import git4idea.GitVcs;
 import git4idea.commands.GitCommand;
-import git4idea.commands.GitFileUtils;
 import git4idea.commands.GitSimpleHandler;
 import git4idea.commands.StringScanner;
 import git4idea.config.GitConfigUtil;
 import git4idea.config.GitVersion;
 import git4idea.ui.GitUIUtil;
 import git4idea.ui.StashInfo;
-import git4idea.vfs.GitVFSListener;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 
-import javax.swing.event.ChangeEvent;
-import java.io.File;
-import java.io.IOException;
 import java.nio.charset.Charset;
-import java.util.*;
 
 /**
  * The class contains utilities for creating and removing stashes.
@@ -66,7 +38,6 @@ public class GitStashUtils {
    * The version when quiet stash supported
    */
   private final static GitVersion QUIET_STASH_SUPPORTED = new GitVersion(1, 6, 4, 0);
-  private static final Logger LOG = Logger.getInstance(GitStashUtils.class.getName());
 
   private GitStashUtils() {
   }
@@ -110,139 +81,4 @@ public class GitStashUtils {
       consumer.consume(new StashInfo(s.boundedToken(':'), s.boundedToken(':'), s.line().trim()));
     }
   }
-
-  /**
-   * Perform system level unshelve operation
-   *
-   * @param project           the project
-   * @param shelvedChangeList the shelved change list
-   * @param shelveManager     the shelve manager
-   * @param restoreListsRunnable
-   */
-  @AsynchronousExecution
-  public static void doSystemUnshelve(final Project project,
-                                      final ShelvedChangeList shelvedChangeList,
-                                      final ShelveChangesManager shelveManager,
-                                      @NotNull final Runnable restoreListsRunnable,
-                                      final @NotNull ContinuationContext context) {
-    VirtualFile baseDir = project.getBaseDir();
-    assert baseDir != null;
-    final String projectPath = baseDir.getPath() + "/";
-
-    context.next(new TaskDescriptor("Refreshing files before unshelve", Where.POOLED) {
-        @Override
-        public void run(ContinuationContext context) {
-          LOG.info("doSystemUnshelve ");
-          // The changes are temporary copied to the first local change list, the next operation will restore them back
-          // Refresh files that might be affected by unshelve
-          refreshFilesBeforeUnshelve(shelvedChangeList, projectPath);
-
-          LOG.info("doSystemUnshelve files refreshed. unshelving in AWT thread.");
-        }
-      }, new TaskDescriptor("", Where.AWT) {
-        @Override
-        public void run(ContinuationContext context) {
-          GitVFSListener l = GitVcs.getInstance(project).getVFSListener();
-          l.setEventsSuppressed(true);
-
-          LOG.info("Unshelving in UI thread. shelvedChangeList: " + shelvedChangeList);
-          // we pass null as target change list for Patch Applier to do NOTHING with change lists
-          shelveManager.scheduleUnshelveChangeList(shelvedChangeList, shelvedChangeList.getChanges(),
-                                                   shelvedChangeList.getBinaryFiles(), null, false, context);
-        }
-      }, new TaskDescriptor("", Where.AWT) {
-      @Override
-      public void run(ContinuationContext context) {
-        GitVcs.getInstance(project).getVFSListener().setEventsSuppressed(false);
-        addFilesAfterUnshelve(project, shelvedChangeList, projectPath, context);
-        ChangeListManager.getInstance(project).invokeAfterUpdate(new Runnable() {
-            @Override
-            public void run() {
-              restoreListsRunnable.run();
-            }
-          }, InvokeAfterUpdateMode.BACKGROUND_NOT_CANCELLABLE_NOT_AWT, "Restoring changelists", ModalityState.NON_MODAL);
-      }
-    });
-  }
-
-  private static void addFilesAfterUnshelve(Project project,
-                                            ShelvedChangeList shelvedChangeList,
-                                            String projectPath, ContinuationContext context) {
-    Collection<FilePath> paths = new ArrayList<FilePath>();
-    for (ShelvedChange c : shelvedChangeList.getChanges()) {
-      if (c.getBeforePath() == null || !c.getBeforePath().equals(c.getAfterPath()) || c.getFileStatus() == FileStatus.ADDED) {
-        paths.add(VcsUtil.getFilePath(projectPath + c.getAfterPath()));
-      }
-    }
-    for (ShelvedBinaryFile f : shelvedChangeList.getBinaryFiles()) {
-      if (f.BEFORE_PATH == null || !f.BEFORE_PATH.equals(f.AFTER_PATH) || f.getFileStatus() == FileStatus.ADDED) {
-        paths.add(VcsUtil.getFilePath(projectPath + f.AFTER_PATH));
-      }
-    }
-    final VcsDirtyScopeManager dsm = VcsDirtyScopeManager.getInstance(project);
-    Map<VirtualFile, List<FilePath>> map = GitUtil.sortGitFilePathsByGitRoot(paths);
-    for (Map.Entry<VirtualFile, List<FilePath>> e : map.entrySet()) {
-      try {
-        GitFileUtils.addPaths(project, e.getKey(), e.getValue());
-        dsm.filePathsDirty(e.getValue(), null);
-      }
-      catch (VcsException e1) {
-        if (! context.handleException(e1)) {
-          AbstractVcsHelper.getInstance(project).showError(e1, "Can not add file to Git");
-          LOG.error("Vcs Exception not handled");
-        }
-      }
-    }
-  }
-
-  private static void refreshFilesBeforeUnshelve(ShelvedChangeList shelvedChangeList, String projectPath) {
-    HashSet<File> filesToRefresh = new HashSet<File>();
-    for (ShelvedChange c : shelvedChangeList.getChanges()) {
-      if (c.getBeforePath() != null) {
-        filesToRefresh.add(new File(projectPath + c.getBeforePath()));
-      }
-      if (c.getAfterPath() != null) {
-        filesToRefresh.add(new File(projectPath + c.getAfterPath()));
-      }
-    }
-    for (ShelvedBinaryFile f : shelvedChangeList.getBinaryFiles()) {
-      if (f.BEFORE_PATH != null) {
-        filesToRefresh.add(new File(projectPath + f.BEFORE_PATH));
-      }
-      if (f.AFTER_PATH != null) {
-        filesToRefresh.add(new File(projectPath + f.BEFORE_PATH));
-      }
-    }
-    LocalFileSystem.getInstance().refreshIoFiles(filesToRefresh);
-  }
-
-  /**
-   * Shelve changes
-   *
-   * @param project       the context project
-   * @param shelveManager the shelve manager
-   * @param changes       the changes to process
-   * @param description   the description of for the shelve
-   * @param exceptions    the generated exceptions
-   * @return created shelved change list or null in case failure
-   */
-  @Nullable
-  public static ShelvedChangeList shelveChanges(final Project project, final ShelveChangesManager shelveManager, Collection<Change> changes,
-                                                final String description,
-                                                final List<VcsException> exceptions) {
-    try {
-      ShelvedChangeList shelve = shelveManager.shelveChanges(changes, description);
-      project.getMessageBus().syncPublisher(ShelveChangesManager.SHELF_TOPIC).stateChanged(new ChangeEvent(GitStashUtils.class));
-      return shelve;
-    }
-    catch (IOException e) {
-      //noinspection ThrowableInstanceNeverThrown
-      exceptions.add(new VcsException("Shelving changes failed: " + description, e));
-      return null;
-    }
-    catch (VcsException e) {
-      exceptions.add(e);
-      return null;
-    }
-  }
 }