vcs: implement ByteBackedContentRevision in LocalHistory

This commit is contained in:
Aleksey Pivovarov
2017-05-10 18:35:29 +03:00
parent fb9f0725b2
commit 3dc8e09070
@@ -20,6 +20,7 @@ import com.intellij.history.core.tree.Entry;
import com.intellij.history.integration.IdeaGateway;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.ByteBackedContentRevision;
import com.intellij.openapi.vcs.changes.ContentRevision;
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
import com.intellij.vcsUtil.VcsUtil;
@@ -62,13 +63,20 @@ public class Difference {
private ContentRevision createContentRevision(final Entry e, final IdeaGateway gw) {
if (e == null) return null;
return new ContentRevision() {
return new ByteBackedContentRevision() {
@Nullable
public String getContent() throws VcsException {
if (e.isDirectory()) return null;
return e.getContent().getString(e, gw);
}
@Nullable
@Override
public byte[] getContentAsBytes() throws VcsException {
if (e.isDirectory()) return null;
return e.getContent().getBytes();
}
@NotNull
public FilePath getFile() {
return VcsUtil.getFilePath(new File(e.getPath()), e.isDirectory());