Search in sources :

Example 36 with Revision

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

the class RevisionsAndDiffsTest method testDoesNotIncludeRevisionsForAnotherEntries.

public void testDoesNotIncludeRevisionsForAnotherEntries() throws IOException {
    getVcs().beginChangeSet();
    createFile("file1.txt");
    getVcs().endChangeSet("1");
    getVcs().beginChangeSet();
    VirtualFile f2 = createFile("file2.txt");
    getVcs().endChangeSet("2");
    List<Revision> rr = getRevisionsFor(f2);
    assertEquals(2, rr.size());
    assertEquals("2", rr.get(1).getChangeSetName());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Revision(com.intellij.history.core.revisions.Revision)

Example 37 with Revision

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

the class RevisionsAndDiffsTest method testRevisionForDirectoryWithTheSameNameAsDeletedOne.

public void testRevisionForDirectoryWithTheSameNameAsDeletedOne() throws IOException {
    VirtualFile dir = createDirectory("dir");
    delete(dir);
    dir = createDirectory("dir");
    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 38 with Revision

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

the class RevisionsAndDiffsTest method testDoesNotIncludeNotModifiedDifferences.

public void testDoesNotIncludeNotModifiedDifferences() throws IOException {
    getVcs().beginChangeSet();
    VirtualFile dir = createDirectory("dir1");
    createFile("dir1/dir2/file.txt");
    createDirectory("dir1/dir3");
    getVcs().endChangeSet(null);
    createFile("dir1/dir3/file.txt");
    List<Revision> rr = getRevisionsFor(dir);
    Revision recent = rr.get(0);
    Revision prev = rr.get(1);
    List<Difference> dd = prev.getDifferencesWith(recent);
    assertEquals(1, dd.size());
    Difference d = dd.get(0);
    assertNull(d.getLeft());
    assertEquals(myRoot.getPath() + "/dir1/dir3/file.txt", d.getRight().getPath());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Revision(com.intellij.history.core.revisions.Revision) Difference(com.intellij.history.core.revisions.Difference)

Example 39 with Revision

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

the class RevisionsAndDiffsTest method testGettingDifferenceBetweenRevisions.

public void testGettingDifferenceBetweenRevisions() throws IOException {
    VirtualFile f = createFile("file.txt", "one");
    loadContent(f);
    setContent(f, "two");
    List<Revision> rr = getRevisionsFor(f);
    Revision recent = rr.get(0);
    Revision prev = rr.get(1);
    List<Difference> dd = prev.getDifferencesWith(recent);
    assertEquals(1, dd.size());
    Difference d = dd.get(0);
    assertContent("one", d.getLeft());
    assertContent("two", d.getRight());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Revision(com.intellij.history.core.revisions.Revision) Difference(com.intellij.history.core.revisions.Difference)

Example 40 with Revision

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

the class RevisionsAndDiffsTest method testGettingEntryFromRevisionInRenamedDir.

public void testGettingEntryFromRevisionInRenamedDir() throws IOException {
    VirtualFile dir = createDirectory("dir");
    VirtualFile f = createFile("dir/file.txt");
    rename(dir, "newDir");
    setContent(f, "xxx");
    List<Revision> rr = getRevisionsFor(f);
    assertEquals(4, rr.size());
    assertEquals(myRoot.getPath() + "/newDir/file.txt", rr.get(0).findEntry().getPath());
    assertEquals(myRoot.getPath() + "/newDir/file.txt", rr.get(1).findEntry().getPath());
    assertEquals(myRoot.getPath() + "/dir/file.txt", rr.get(2).findEntry().getPath());
}
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