Search in sources :

Example 21 with Entry

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

the class LocalHistoryEventDispatcher method beforeFileDeletion.

@Override
public void beforeFileDeletion(@NotNull VirtualFileEvent e) {
    VirtualFile f = e.getFile();
    Entry entry = myGateway.createEntryForDeletion(f);
    if (entry != null) {
        myVcs.deleted(f.getPath(), entry);
    }
}
Also used : Entry(com.intellij.history.core.tree.Entry)

Example 22 with Entry

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

the class DifferenceReverter method doRevert.

public void doRevert(boolean revertContentChanges) throws IOException {
    Set<String> vetoedFiles = new THashSet<>();
    for (Difference each : ContainerUtil.iterateBackward(myDiffs)) {
        Entry l = each.getLeft();
        Entry r = each.getRight();
        if (l == null) {
            revertCreation(r, vetoedFiles);
            continue;
        }
        vetoedFiles.add(l.getPath());
        if (r == null) {
            revertDeletion(l);
            continue;
        }
        VirtualFile file = myGateway.findOrCreateFileSafely(r.getPath(), r.isDirectory());
        revertRename(l, file);
        if (revertContentChanges)
            revertContentChange(l, file);
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Entry(com.intellij.history.core.tree.Entry) Difference(com.intellij.history.core.revisions.Difference) THashSet(gnu.trove.THashSet)

Example 23 with Entry

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

the class ContentChange method revertOn.

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

Example 24 with Entry

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

the class MoveChange method revertOn.

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

Example 25 with Entry

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

the class ROStatusChange method revertOn.

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

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