Search in sources :

Example 1 with Content

use of com.intellij.history.core.Content in project intellij-community by JetBrains.

the class SelectionCalculator method getRevisionContent.

@Nullable
private String getRevisionContent(Revision r) {
    Entry e = r.findEntry();
    if (e == null)
        return null;
    Content c = e.getContent();
    if (!c.isAvailable())
        throw new ContentIsUnavailableException();
    return c.getString(e, myGateway);
}
Also used : Entry(com.intellij.history.core.tree.Entry) Content(com.intellij.history.core.Content) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with Content

use of com.intellij.history.core.Content in project intellij-community by JetBrains.

the class DifferenceReverter method setContent.

private void setContent(Entry l, VirtualFile file) throws IOException {
    Content c = l.getContent();
    if (!c.isAvailable())
        return;
    file.setBinaryContent(c.getBytes(), -1, l.getTimestamp());
}
Also used : Content(com.intellij.history.core.Content)

Example 3 with Content

use of com.intellij.history.core.Content in project intellij-community by JetBrains.

the class DirectoryEntryTest method testCaseInsensitiveChildrenDiffProcessing.

@Test
public void testCaseInsensitiveChildrenDiffProcessing() {
    DirectoryEntry e1 = new DirectoryEntry("dir");
    Content content = c("content");
    final String name = "name";
    final String name_v2 = "NAME";
    final String name2 = "Name2";
    final String name2_v2 = "name2";
    e1.addChild(new FileEntry(name, content, -1, false));
    e1.addChild(new FileEntry(name2, content, -1, false));
    DirectoryEntry e2 = new DirectoryEntry("dir");
    e2.addChild(new FileEntry(name_v2, content, -1, false));
    e2.addChild(new FileEntry(name2_v2, content, -1, false));
    try {
        Paths.setCaseSensitive(false);
        List<Difference> differences = Entry.getDifferencesBetween(e1, e2);
        assertEquals(2, differences.size());
        assertEquals(name, differences.get(0).getLeft().getName());
        assertEquals(name_v2, differences.get(0).getRight().getName());
        assertEquals(name2, differences.get(1).getLeft().getName());
        assertEquals(name2_v2, differences.get(1).getRight().getName());
    } finally {
        Paths.useSystemCaseSensitivity();
    }
}
Also used : StoredContent(com.intellij.history.core.StoredContent) Content(com.intellij.history.core.Content) Difference(com.intellij.history.core.revisions.Difference) Test(org.junit.Test)

Aggregations

Content (com.intellij.history.core.Content)3 StoredContent (com.intellij.history.core.StoredContent)1 Difference (com.intellij.history.core.revisions.Difference)1 Entry (com.intellij.history.core.tree.Entry)1 Nullable (org.jetbrains.annotations.Nullable)1 Test (org.junit.Test)1