mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
vcs: do not load file content to memory to copy file
EA-116778 - FTBE: FileUtil.loadFileBytes
This commit is contained in:
+3
-4
@@ -36,9 +36,7 @@ import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileWithoutContent;
|
||||
import com.intellij.openapi.vfs.*;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.LineSeparator;
|
||||
import com.intellij.util.PathUtil;
|
||||
@@ -363,7 +361,8 @@ public class ExternalDiffToolUtil {
|
||||
|
||||
@Override
|
||||
public void apply() throws IOException {
|
||||
myFile.setBinaryContent(FileUtil.loadFileBytes(myLocalFile));
|
||||
FileUtil.copy(myLocalFile, VfsUtilCore.virtualToIoFile(myFile));
|
||||
VfsUtil.markDirty(false, false, myFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -22,6 +22,8 @@ import com.intellij.openapi.vcs.FilePath;
|
||||
import com.intellij.openapi.vcs.changes.CommitContext;
|
||||
import com.intellij.openapi.vcs.changes.shelf.ShelvedBinaryFile;
|
||||
import com.intellij.openapi.vcs.changes.shelf.ShelvedBinaryFilePatch;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
|
||||
import java.io.File;
|
||||
@@ -43,7 +45,10 @@ public class ApplyBinaryShelvedFilePatch extends ApplyFilePatchBase<ShelvedBinar
|
||||
fileToPatch.delete(this);
|
||||
}
|
||||
else {
|
||||
fileToPatch.setBinaryContent(FileUtil.loadFileBytes(new File(shelvedBinaryFile.SHELVED_PATH)));
|
||||
File fromFile = new File(shelvedBinaryFile.SHELVED_PATH);
|
||||
File toFile = VfsUtilCore.virtualToIoFile(fileToPatch);
|
||||
FileUtil.copy(fromFile, toFile);
|
||||
VfsUtil.markDirty(false, false, fileToPatch);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user