Search in sources :

Example 6 with Entry

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

the class DeleteChange method revertOn.

@Override
public void revertOn(RootEntry root, boolean warnOnFileNotFound) {
    String parentPath = Paths.getParentOf(myPath);
    Entry parent = root.findEntry(parentPath);
    if (parent == null) {
        cannotRevert(parentPath, warnOnFileNotFound);
        return;
    }
    parent.addChild(myDeletedEntry.copy());
}
Also used : Entry(com.intellij.history.core.tree.Entry) RootEntry(com.intellij.history.core.tree.RootEntry)

Example 7 with Entry

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

the class RenameChange method revertOn.

@Override
public void revertOn(RootEntry root, boolean warnOnFileNotFound) {
    Entry e = root.findEntry(myPath);
    if (e == null) {
        cannotRevert(myPath, warnOnFileNotFound);
        return;
    }
    e.setName(myOldName);
}
Also used : Entry(com.intellij.history.core.tree.Entry) RootEntry(com.intellij.history.core.tree.RootEntry)

Example 8 with Entry

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

the class LocalHistoryTestCase method changeROStatus.

public ROStatusChange changeROStatus(RootEntry root, String path, boolean status) {
    Entry e = root.getEntry(path);
    ROStatusChange result = new ROStatusChange(nextId(), path, e.isReadOnly());
    e.setReadOnly(status);
    return result;
}
Also used : RootEntry(com.intellij.history.core.tree.RootEntry) FileEntry(com.intellij.history.core.tree.FileEntry) Entry(com.intellij.history.core.tree.Entry)

Example 9 with Entry

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

the class LocalHistoryTestCase method move.

public MoveChange move(RootEntry root, String path, String newParent) {
    Entry e = root.getEntry(path);
    MoveChange result = new MoveChange(nextId(), Paths.reparented(path, newParent), e.getParent().getPath());
    e.getParent().removeChild(e);
    root.getEntry(newParent).addChild(e);
    return result;
}
Also used : RootEntry(com.intellij.history.core.tree.RootEntry) FileEntry(com.intellij.history.core.tree.FileEntry) Entry(com.intellij.history.core.tree.Entry)

Example 10 with Entry

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

the class StreamTest method testDirectoryEntryWithChildren.

@Test
public void testDirectoryEntryWithChildren() throws IOException {
    Entry dir = new DirectoryEntry("");
    Entry subDir = new DirectoryEntry("");
    dir.addChild(subDir);
    subDir.addChild(new FileEntry("a", new StoredContent(333), -1, false));
    subDir.addChild(new FileEntry("b", new StoredContent(333), -1, false));
    StreamUtil.writeEntry(os, dir);
    Entry result = StreamUtil.readEntry(is);
    List<Entry> children = result.getChildren();
    assertEquals(1, children.size());
    Entry e = children.get(0);
    assertEquals(DirectoryEntry.class, e.getClass());
    assertSame(result, e.getParent());
    children = e.getChildren();
    assertEquals(2, children.size());
    assertEquals(FileEntry.class, children.get(0).getClass());
    assertSame(e, children.get(0).getParent());
    assertEquals(FileEntry.class, children.get(1).getClass());
    assertSame(e, children.get(1).getParent());
}
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) FileEntry(com.intellij.history.core.tree.FileEntry) StoredContent(com.intellij.history.core.StoredContent) DirectoryEntry(com.intellij.history.core.tree.DirectoryEntry) Test(org.junit.Test)

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