use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.
the class SelectionCalculatorTest method testNormalizingLineEnds.
@Test
public void testNormalizingLineEnds() throws FilesTooBigForDiffException {
List<Revision> rr = createRevisions("abc\ndef\nghi", "abc\r\ndef\r\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, "abc\ndef", b0);
assertBlock(0, 2, "abc\ndef", b1);
}
use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.
the class RevisionsAndDiffsTest method testRevisions.
public void testRevisions() throws Exception {
VirtualFile f = createFile("file.txt", "old");
loadContent(f);
setContent(f, "new");
List<Revision> rr = getRevisionsFor(f);
assertEquals(3, rr.size());
assertContent("new", rr.get(0).findEntry());
assertContent("old", rr.get(1).findEntry());
}
use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.
the class RevisionsAndDiffsTest method testRevisionsForFileCreatedWithSameNameAsDeletedOne.
public void testRevisionsForFileCreatedWithSameNameAsDeletedOne() throws IOException {
VirtualFile f = createFile("file.txt", "old");
loadContent(f);
delete(f);
f = createFile("file.txt", "new");
loadContent(f);
List<Revision> rr = getRevisionsFor(f);
assertEquals(4, rr.size());
Entry e = rr.get(0).findEntry();
assertEquals("file.txt", e.getName());
assertContent("new", e);
assertNull(rr.get(1).findEntry());
e = rr.get(2).findEntry();
assertEquals("file.txt", e.getName());
assertContent("old", e);
assertNull(rr.get(3).findEntry());
}
use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.
the class RevisionsAndDiffsTest method testRevisionsForFileCreatedInPlaceOfRenamedOne.
public void testRevisionsForFileCreatedInPlaceOfRenamedOne() throws IOException {
VirtualFile f = createFile("file1.txt", "content1");
loadContent(f);
rename(f, "file2.txt");
VirtualFile ff = createFile("file1.txt", "content2");
loadContent(ff);
List<Revision> rr = getRevisionsFor(ff);
assertEquals(2, rr.size());
Entry e = rr.get(0).findEntry();
assertEquals("file1.txt", e.getName());
assertContent("content2", e);
rr = getRevisionsFor(f);
assertEquals(3, rr.size());
e = rr.get(0).findEntry();
assertEquals("file2.txt", e.getName());
assertContent("content1", e);
e = rr.get(1).findEntry();
assertEquals("file1.txt", e.getName());
assertContent("content1", e);
}
use of com.intellij.history.core.revisions.Revision 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