use of com.intellij.openapi.vcs.changes.shelf.ShelvedBinaryContentRevision in project intellij-community by JetBrains.
the class ApplyBinaryShelvedFilePatch method applyChange.
protected Result applyChange(Project project, final VirtualFile fileToPatch, FilePath pathBeforeRename, Getter<CharSequence> baseContents) throws IOException {
try {
ContentRevision contentRevision = myPatch.getShelvedBinaryFile().createChange(project).getAfterRevision();
if (contentRevision != null) {
assert (contentRevision instanceof ShelvedBinaryContentRevision);
byte[] binaryContent = ((ShelvedBinaryContentRevision) contentRevision).getBinaryContent();
//it may be new empty binary file
fileToPatch.setBinaryContent(binaryContent != null ? binaryContent : ArrayUtil.EMPTY_BYTE_ARRAY);
}
} catch (VcsException e) {
LOG.error("Couldn't apply shelved binary patch", e);
return new Result(ApplyPatchStatus.FAILURE) {
@Override
public ApplyPatchForBaseRevisionTexts getMergeData() {
return null;
}
};
}
return SUCCESS;
}
Aggregations