mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[patch]: IDEA-170016 implement binary patch creation from prev revisions
* (IDEA-160482, IDEA-160483) Support creating patch with binary files from shelve; * test added;
This commit is contained in:
@@ -25,7 +25,10 @@ import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.openapi.vcs.changes.patch.BlobIndexUtil.NOT_COMMITTED_HASH;
|
||||
@@ -72,8 +75,7 @@ public class BinaryPatchWriter {
|
||||
writer.write(String.format(LITERAL_HEADER, afterContent == null ? 0 : afterContent.length));
|
||||
writer.write(lineSeparator);
|
||||
try {
|
||||
BinaryEncoder
|
||||
.encode(afterFile.exists() ? new FileInputStream(afterFile) : new ByteArrayInputStream(ArrayUtil.EMPTY_BYTE_ARRAY), writer);
|
||||
BinaryEncoder.encode(new ByteArrayInputStream(afterContent != null ? afterContent : ArrayUtil.EMPTY_BYTE_ARRAY), writer);
|
||||
}
|
||||
catch (BinaryEncoder.BinaryPatchException e) {
|
||||
LOG.error("Can't write patch for binary file: " + afterFile.getPath(), e);
|
||||
|
||||
Reference in New Issue
Block a user