Search in sources :

Example 16 with Revision

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

the class SelectionReverterTest method testChangeSetName.

public void testChangeSetName() throws IOException {
    long time = new Date(2001, 1, 11, 12, 30).getTime();
    Clock.setTime(time);
    setBinaryContent(f, "one".getBytes());
    setBinaryContent(f, "two".getBytes());
    revertToPreviousRevision(0, 0);
    List<Revision> rr = getRevisionsFor(f);
    assertEquals(5, rr.size());
    assertEquals("Reverted to " + DateFormatUtil.formatDateTime(time), rr.get(1).getChangeSetName());
}
Also used : Revision(com.intellij.history.core.revisions.Revision) Date(java.util.Date)

Example 17 with Revision

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

the class DirectoryChangeModelTest method testNames.

public void testNames() throws IOException {
    VirtualFile f = createDirectory("foo");
    rename(f, "bar");
    List<Revision> revs = getRevisionsFor(f);
    Difference d = new Difference(false, revs.get(0).findEntry(), revs.get(1).findEntry());
    DirectoryChangeModel m = createModelOn(d);
    assertEquals("bar", m.getEntryName(0));
    assertEquals("foo", m.getEntryName(1));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Revision(com.intellij.history.core.revisions.Revision) DirectoryChangeModel(com.intellij.history.integration.ui.models.DirectoryChangeModel) Difference(com.intellij.history.core.revisions.Difference)

Example 18 with Revision

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

the class DirectoryChangeModelTest method testCanShowFileDifference.

public void testCanShowFileDifference() throws IOException {
    VirtualFile f = createFile("foo.txt");
    setContent(f, "xxx");
    List<Revision> revs = getRevisionsFor(f);
    Difference d1 = new Difference(true, revs.get(0).findEntry(), revs.get(1).findEntry());
    Difference d2 = new Difference(true, null, revs.get(1).findEntry());
    Difference d3 = new Difference(true, revs.get(1).findEntry(), null);
    assertTrue(createModelOn(d1).canShowFileDifference());
    assertTrue(createModelOn(d2).canShowFileDifference());
    assertTrue(createModelOn(d3).canShowFileDifference());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Revision(com.intellij.history.core.revisions.Revision) Difference(com.intellij.history.core.revisions.Difference)

Example 19 with Revision

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

the class SelectionCalculatorTest method testSelectionWasMoved.

@Test
public void testSelectionWasMoved() throws FilesTooBigForDiffException {
    List<Revision> rr = createRevisions("abc\ndef\nghi", "def\nghi");
    SelectionCalculator c = new SelectionCalculator(gw, rr, 0, 1);
    Block b0 = c.getSelectionFor(rr.get(0), new NullProgress());
    Block b1 = c.getSelectionFor(rr.get(1), new NullProgress());
    assertBlock(0, 2, "def\nghi", b0);
    assertBlock(1, 3, "def\nghi", b1);
}
Also used : Revision(com.intellij.history.core.revisions.Revision) Block(com.intellij.diff.Block) Test(org.junit.Test)

Example 20 with Revision

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

the class SelectionCalculatorTest method testSelectionWasNotChanged.

@Test
public void testSelectionWasNotChanged() throws FilesTooBigForDiffException {
    List<Revision> rr = createRevisions("abc\ndef\nghi", "abc1\ndef1\nghi1");
    SelectionCalculator c = new SelectionCalculator(gw, rr, 0, 2);
    Block b0 = c.getSelectionFor(rr.get(0), new NullProgress());
    Block b1 = c.getSelectionFor(rr.get(1), new NullProgress());
    assertBlock(0, 3, "abc1\ndef1\nghi1", b0);
    assertBlock(0, 3, "abc\ndef\nghi", b1);
}
Also used : Revision(com.intellij.history.core.revisions.Revision) Block(com.intellij.diff.Block) Test(org.junit.Test)

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