Search in sources :

Example 1 with DeleteChange

use of com.intellij.history.core.changes.DeleteChange 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)

Aggregations

Change (com.intellij.history.core.changes.Change)1 DeleteChange (com.intellij.history.core.changes.DeleteChange)1 StructuralChange (com.intellij.history.core.changes.StructuralChange)1 Entry (com.intellij.history.core.tree.Entry)1 NewVirtualFile (com.intellij.openapi.vfs.newvfs.NewVirtualFile)1