private boolean checkIfThereAreFakeRevisions(final Project project, final Change[] changes) { boolean needsConvertion = false; for (Change change : changes) { final ContentRevision beforeRevision = change.getBeforeRevision(); final ContentRevision afterRevision = change.getAfterRevision(); if (beforeRevision instanceof FakeRevision) { VcsDirtyScopeManager.getInstance(project).fileDirty(beforeRevision.getFile()); needsConvertion = true; } if (afterRevision instanceof FakeRevision) { VcsDirtyScopeManager.getInstance(project).fileDirty(afterRevision.getFile()); needsConvertion = true; } } return needsConvertion; }
private static FileContent createBinaryFileContent( final Project project, final ContentRevision contentRevision, final String fileName) throws VcsException, IOException { final FileContent fileContent; if (contentRevision == null) { fileContent = FileContent.createFromTempFile(project, fileName, fileName, ArrayUtil.EMPTY_BYTE_ARRAY); } else { byte[] content = ((BinaryContentRevision) contentRevision).getBinaryContent(); fileContent = FileContent.createFromTempFile( project, contentRevision.getFile().getName(), contentRevision.getFile().getName(), content == null ? ArrayUtil.EMPTY_BYTE_ARRAY : content); } return fileContent; }