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));
}
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));
}
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());
}
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());
}
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);
}
Aggregations