use of com.intellij.openapi.vcs.merge.MergeData in project intellij-community by JetBrains.
the class CvsMergeProvider method loadRevisions.
@Override
@NotNull
public MergeData loadRevisions(@NotNull VirtualFile file) throws VcsException {
try {
final Entry entry = CvsEntriesManager.getInstance().getEntryFor(file);
final File cvsFile = CvsVfsUtil.getFileFor(file);
if (entry != null && entry.isResultOfMerge() && entry.isBinary()) {
final String originalRevision = CvsUtil.getOriginalRevisionForFile(file);
final MergeData mergeData = new MergeData();
mergeData.CURRENT = CvsUtil.getStoredContentForFile(file, originalRevision);
mergeData.LAST = FileUtil.loadFileBytes(cvsFile);
return mergeData;
}
final BufferedInputStream input = new BufferedInputStream(new FileInputStream(cvsFile));
try {
final CvsConflictsParser parser = CvsConflictsParser.createOn(input);
final MergeData mergeData = new MergeData();
mergeData.ORIGINAL = parser.getCenterVersion().getBytes();
mergeData.CURRENT = parser.getLeftVersion().getBytes();
mergeData.LAST = parser.getRightVersion().getBytes();
return mergeData;
} finally {
input.close();
}
} catch (IOException e) {
throw new VcsException(e);
}
}
Aggregations