Search in sources :

Example 1 with GitHandler

use of git4idea.commands.GitHandler in project intellij-community by JetBrains.

the class GitVFSListener method performForceMove.

private void performForceMove(@NotNull List<MovedFileInfo> files) {
    Map<FilePath, MovedFileInfo> filesToMove = map2Map(files, (info) -> Pair.create(VcsUtil.getFilePath(info.myNewPath), info));
    Set<File> toRefresh = newHashSet();
    performBackgroundOperation(filesToMove.keySet(), "Moving Files...", new LongOperationPerRootExecutor() {

        @Override
        public void execute(@NotNull VirtualFile root, @NotNull List<FilePath> files) throws VcsException {
            for (FilePath file : files) {
                GitHandler h = new GitSimpleHandler(myProject, root, GitCommand.MV);
                MovedFileInfo info = filesToMove.get(file);
                h.addParameters("-f", info.myOldPath, info.myNewPath);
                h.runInCurrentThread(null);
                toRefresh.add(new File(info.myOldPath));
                toRefresh.add(new File(info.myNewPath));
            }
        }

        @Override
        public Collection<File> getFilesToRefresh() {
            return toRefresh;
        }
    });
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) VirtualFile(com.intellij.openapi.vfs.VirtualFile) GitSimpleHandler(git4idea.commands.GitSimpleHandler) GitHandler(git4idea.commands.GitHandler) VcsException(com.intellij.openapi.vcs.VcsException) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Aggregations

FilePath (com.intellij.openapi.vcs.FilePath)1 VcsException (com.intellij.openapi.vcs.VcsException)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 GitHandler (git4idea.commands.GitHandler)1 GitSimpleHandler (git4idea.commands.GitSimpleHandler)1 File (java.io.File)1