Search in sources :

Example 16 with Entry

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

the class StreamTest method testEmptyDirectoryEntry.

@Test
public void testEmptyDirectoryEntry() throws IOException {
    Entry e = new DirectoryEntry("name");
    StreamUtil.writeEntry(os, e);
    Entry result = StreamUtil.readEntry(is);
    assertEquals(DirectoryEntry.class, result.getClass());
    assertEquals("name", result.getName());
}
Also used : DirectoryEntry(com.intellij.history.core.tree.DirectoryEntry) Entry(com.intellij.history.core.tree.Entry) RootEntry(com.intellij.history.core.tree.RootEntry) FileEntry(com.intellij.history.core.tree.FileEntry) DirectoryEntry(com.intellij.history.core.tree.DirectoryEntry) Test(org.junit.Test)

Example 17 with Entry

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

the class FileListeningTest method testDeletionDoesNotVersionIgnoredFilesRecursively.

public void testDeletionDoesNotVersionIgnoredFilesRecursively() throws Exception {
    String dir1 = createDirectoryExternally("dir");
    createFileExternally("dir/f.txt");
    createFileExternally("dir/f.class");
    createFileExternally("dir/subdir/f.txt");
    createDirectoryExternally("dir/subdir/subdir2");
    createFileExternally("dir/subdir/subdir2/f.txt");
    LocalFileSystem.getInstance().refresh(false);
    addExcludedDir(myRoot.getPath() + "/dir/subdir");
    addContentRoot(myRoot.getPath() + "/dir/subdir/subdir2");
    final VirtualFile vDir1 = LocalFileSystem.getInstance().findFileByPath(dir1);
    assertNotNull(dir1, vDir1);
    delete(vDir1);
    List<Change> changes = getVcs().getChangeListInTests().getChangesInTests().get(0).getChanges();
    assertEquals(1, changes.size());
    Entry e = ((DeleteChange) changes.get(0)).getDeletedEntry();
    final List<Entry> children = e.getChildren();
    sortEntries(children);
    assertEquals(2, children.size());
    assertEquals("f.txt", children.get(0).getName());
    assertEquals("subdir", children.get(1).getName());
    assertEquals(1, children.get(1).getChildren().size());
    assertEquals("subdir2", children.get(1).getChildren().get(0).getName());
}
Also used : NewVirtualFile(com.intellij.openapi.vfs.newvfs.NewVirtualFile) Entry(com.intellij.history.core.tree.Entry) DeleteChange(com.intellij.history.core.changes.DeleteChange) DeleteChange(com.intellij.history.core.changes.DeleteChange) StructuralChange(com.intellij.history.core.changes.StructuralChange) Change(com.intellij.history.core.changes.Change)

Example 18 with Entry

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

the class DirectoryChangeModelTest method testCanNotShowFileDifferenceForDirectories.

public void testCanNotShowFileDifferenceForDirectories() {
    Entry left = new DirectoryEntry("left");
    Entry right = new DirectoryEntry("right");
    Difference d = new Difference(false, left, right);
    assertFalse(createModelOn(d).canShowFileDifference());
}
Also used : DirectoryEntry(com.intellij.history.core.tree.DirectoryEntry) Entry(com.intellij.history.core.tree.Entry) Difference(com.intellij.history.core.revisions.Difference) DirectoryEntry(com.intellij.history.core.tree.DirectoryEntry)

Example 19 with Entry

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

the class RevisionsAndDiffsTest method testRevisionsForFileCreatedWithSameNameAsDeletedOne.

public void testRevisionsForFileCreatedWithSameNameAsDeletedOne() throws IOException {
    VirtualFile f = createFile("file.txt", "old");
    loadContent(f);
    delete(f);
    f = createFile("file.txt", "new");
    loadContent(f);
    List<Revision> rr = getRevisionsFor(f);
    assertEquals(4, rr.size());
    Entry e = rr.get(0).findEntry();
    assertEquals("file.txt", e.getName());
    assertContent("new", e);
    assertNull(rr.get(1).findEntry());
    e = rr.get(2).findEntry();
    assertEquals("file.txt", e.getName());
    assertContent("old", e);
    assertNull(rr.get(3).findEntry());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Entry(com.intellij.history.core.tree.Entry) Revision(com.intellij.history.core.revisions.Revision)

Example 20 with Entry

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

the class RevisionsAndDiffsTest method testRevisionsForFileCreatedInPlaceOfRenamedOne.

public void testRevisionsForFileCreatedInPlaceOfRenamedOne() throws IOException {
    VirtualFile f = createFile("file1.txt", "content1");
    loadContent(f);
    rename(f, "file2.txt");
    VirtualFile ff = createFile("file1.txt", "content2");
    loadContent(ff);
    List<Revision> rr = getRevisionsFor(ff);
    assertEquals(2, rr.size());
    Entry e = rr.get(0).findEntry();
    assertEquals("file1.txt", e.getName());
    assertContent("content2", e);
    rr = getRevisionsFor(f);
    assertEquals(3, rr.size());
    e = rr.get(0).findEntry();
    assertEquals("file2.txt", e.getName());
    assertContent("content1", e);
    e = rr.get(1).findEntry();
    assertEquals("file1.txt", e.getName());
    assertContent("content1", e);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Entry(com.intellij.history.core.tree.Entry) Revision(com.intellij.history.core.revisions.Revision)

Aggregations

Entry (com.intellij.history.core.tree.Entry)37 RootEntry (com.intellij.history.core.tree.RootEntry)25 FileEntry (com.intellij.history.core.tree.FileEntry)12 Test (org.junit.Test)12 DirectoryEntry (com.intellij.history.core.tree.DirectoryEntry)11 VirtualFile (com.intellij.openapi.vfs.VirtualFile)7 Revision (com.intellij.history.core.revisions.Revision)5 StoredContent (com.intellij.history.core.StoredContent)4 Difference (com.intellij.history.core.revisions.Difference)3 NewVirtualFile (com.intellij.openapi.vfs.newvfs.NewVirtualFile)2 ByteContent (com.intellij.history.ByteContent)1 Content (com.intellij.history.core.Content)1 Change (com.intellij.history.core.changes.Change)1 DeleteChange (com.intellij.history.core.changes.DeleteChange)1 StructuralChange (com.intellij.history.core.changes.StructuralChange)1 SelectionCalculator (com.intellij.history.integration.ui.models.SelectionCalculator)1 VirtualFileSystemEntry (com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry)1 THashSet (gnu.trove.THashSet)1 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1