Search in sources :

Example 31 with Revision

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

the class RevisionsAndDiffsTest method testNoDifferenceForDirectoryWithEqualContents.

public void testNoDifferenceForDirectoryWithEqualContents() throws IOException {
    VirtualFile dir = createDirectory("dir");
    VirtualFile f = createFile("dir/file.txt");
    delete(f);
    List<Revision> rr = getRevisionsFor(dir);
    assertTrue(rr.get(0).getDifferencesWith(rr.get(2)).isEmpty());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Revision(com.intellij.history.core.revisions.Revision)

Example 32 with Revision

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

the class RevisionsAndDiffsTest method testRevisionsIfSomeFilesWereDeletedDuringChangeSet.

public void testRevisionsIfSomeFilesWereDeletedDuringChangeSet() throws IOException {
    VirtualFile dir = createDirectory("dir");
    VirtualFile f = createFile("dir/f.txt");
    getVcs().beginChangeSet();
    delete(f);
    List<Revision> rr = getRevisionsFor(dir);
    assertEquals(4, rr.size());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Revision(com.intellij.history.core.revisions.Revision)

Example 33 with Revision

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

the class RevisionsAndDiffsTest method testIncludingCurrentVersionIntoRevisionsAfterPurge.

public void testIncludingCurrentVersionIntoRevisionsAfterPurge() throws Exception {
    Clock.setTime(10);
    VirtualFile f = createFile("file.txt", "content");
    loadContent(f);
    getVcs().getChangeListInTests().purgeObsolete(0);
    List<Revision> rr = getRevisionsFor(f);
    assertEquals(1, rr.size());
    Revision r = rr.get(0);
    assertNull(r.getLabel());
    assertNull(r.getChangeSetName());
    assertEquals(f.getTimeStamp(), r.getTimestamp());
    Entry e = r.findEntry();
    assertEquals("file.txt", e.getName());
    assertContent("content", e);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Entry(com.intellij.history.core.tree.Entry) Revision(com.intellij.history.core.revisions.Revision)

Example 34 with Revision

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

the class RevisionsAndDiffsTest method testRevisionsForFileThatWasCreatedAndDeletedInOneChangeSet.

public void testRevisionsForFileThatWasCreatedAndDeletedInOneChangeSet() throws IOException {
    getVcs().beginChangeSet();
    VirtualFile f = createFile("f.txt");
    getVcs().endChangeSet("1");
    delete(f);
    getVcs().beginChangeSet();
    f = createFile("f.txt");
    delete(f);
    getVcs().endChangeSet("2");
    getVcs().beginChangeSet();
    f = createFile("f.txt");
    getVcs().endChangeSet("3");
    getVcs().beginChangeSet();
    delete(f);
    f = createFile("f.txt");
    getVcs().endChangeSet("4");
    List<Revision> rr = getRevisionsFor(f);
    assertEquals(6, rr.size());
    assertEquals("4", rr.get(1).getChangeSetName());
    assertEquals("3", rr.get(2).getChangeSetName());
    assertEquals("2", rr.get(3).getChangeSetName());
    assertEquals(null, rr.get(4).getChangeSetName());
    assertEquals("1", rr.get(5).getChangeSetName());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Revision(com.intellij.history.core.revisions.Revision)

Example 35 with Revision

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

the class RevisionsAndDiffsTest method testTimestampForLastRevisionAfterPurge.

public void testTimestampForLastRevisionAfterPurge() throws IOException {
    Clock.setTime(10);
    VirtualFile f = createFile("file1.txt");
    Clock.setTime(20);
    setContent(f, "a");
    Clock.setTime(30);
    setContent(f, "b");
    getVcs().getChangeListInTests().purgeObsolete(15);
    List<Revision> rr = getRevisionsFor(f);
    assertEquals(30L, rr.get(1).getTimestamp());
    assertEquals(20L, rr.get(2).getTimestamp());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Revision(com.intellij.history.core.revisions.Revision)

Aggregations

Revision (com.intellij.history.core.revisions.Revision)44 VirtualFile (com.intellij.openapi.vfs.VirtualFile)29 Difference (com.intellij.history.core.revisions.Difference)7 Test (org.junit.Test)6 Entry (com.intellij.history.core.tree.Entry)5 Block (com.intellij.diff.Block)4 LocalHistoryAction (com.intellij.history.LocalHistoryAction)3 ArrayList (java.util.ArrayList)3 Module (com.intellij.openapi.module.Module)2 NewVirtualFile (com.intellij.openapi.vfs.newvfs.NewVirtualFile)2 File (java.io.File)2 ChangeRevision (com.intellij.history.core.revisions.ChangeRevision)1 RecentChange (com.intellij.history.core.revisions.RecentChange)1 DifferenceReverter (com.intellij.history.integration.revertion.DifferenceReverter)1 DirectoryChangeModel (com.intellij.history.integration.ui.models.DirectoryChangeModel)1 SelectionCalculator (com.intellij.history.integration.ui.models.SelectionCalculator)1 RunnableAdapter (com.intellij.history.utils.RunnableAdapter)1 Change (com.intellij.openapi.vcs.changes.Change)1 IOException (java.io.IOException)1 Date (java.util.Date)1