Search in sources :

Example 1 with Difference

use of com.intellij.history.core.revisions.Difference 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 2 with Difference

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

the class DirectoryChangeModelTest method testNamesForAbsentEntries.

public void testNamesForAbsentEntries() {
    Difference d = new Difference(false, null, null);
    DirectoryChangeModel m = createModelOn(d);
    assertEquals("", m.getEntryName(0));
    assertEquals("", m.getEntryName(1));
}
Also used : DirectoryChangeModel(com.intellij.history.integration.ui.models.DirectoryChangeModel) Difference(com.intellij.history.core.revisions.Difference)

Example 3 with Difference

use of com.intellij.history.core.revisions.Difference 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 4 with Difference

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

the class DirectoryChangeModelTest method testCanNotShowFileDifferenceForDirectories.

public void testCanNotShowFileDifferenceForDirectories() {
    Entry left = new DirectoryEntry("left");
    Entry right = new DirectoryEntry("right");
    Difference d = new Difference(false, left, right);
    assertFalse(createModelOn(d).canShowFileDifference());
}
Also used : DirectoryEntry(com.intellij.history.core.tree.DirectoryEntry) Entry(com.intellij.history.core.tree.Entry) Difference(com.intellij.history.core.revisions.Difference) DirectoryEntry(com.intellij.history.core.tree.DirectoryEntry)

Example 5 with Difference

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

the class PatchCreatorTest method createPatchBetweenRevisions.

private void createPatchBetweenRevisions(int left, int right, boolean reverse) throws Exception {
    List<Revision> rr = getRevisionsFor(myRoot);
    Revision l = rr.get(left);
    Revision r = rr.get(right);
    List<Difference> dd = l.getDifferencesWith(r);
    List<Change> cc = new ArrayList<>();
    for (Difference d : dd) {
        Change c = new Change(d.getLeftContentRevision(myGateway), d.getRightContentRevision(myGateway));
        cc.add(c);
    }
    PatchCreator.create(myProject, cc, patchFilePath, reverse, null);
}
Also used : Revision(com.intellij.history.core.revisions.Revision) ArrayList(java.util.ArrayList) Difference(com.intellij.history.core.revisions.Difference) Change(com.intellij.openapi.vcs.changes.Change)

Aggregations

Difference (com.intellij.history.core.revisions.Difference)15 Revision (com.intellij.history.core.revisions.Revision)7 VirtualFile (com.intellij.openapi.vfs.VirtualFile)7 ArrayList (java.util.ArrayList)4 Entry (com.intellij.history.core.tree.Entry)3 DirectoryChangeModel (com.intellij.history.integration.ui.models.DirectoryChangeModel)2 Change (com.intellij.openapi.vcs.changes.Change)2 Content (com.intellij.history.core.Content)1 StoredContent (com.intellij.history.core.StoredContent)1 DirectoryEntry (com.intellij.history.core.tree.DirectoryEntry)1 THashMap (gnu.trove.THashMap)1 THashSet (gnu.trove.THashSet)1 TIntObjectHashMap (gnu.trove.TIntObjectHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 Test (org.junit.Test)1