use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.
the class RevisionsAndDiffsTest method testIncludingVersionBeforeFirstChangeAfterPurge.
public void testIncludingVersionBeforeFirstChangeAfterPurge() throws IOException {
Clock.setTime(10);
VirtualFile f = createFile("file.txt", "one");
loadContent(f);
Clock.setTime(20);
setContent(f, "two");
getVcs().getChangeListInTests().purgeObsolete(5);
List<Revision> rr = getRevisionsFor(f);
assertEquals(2, rr.size());
assertContent("two", rr.get(0).findEntry());
assertContent("one", rr.get(1).findEntry());
}
use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.
the class RevisionsAndDiffsTest method testCurrentRevisionForDirectoryAfterPurge.
public void testCurrentRevisionForDirectoryAfterPurge() throws Exception {
Clock.setTime(10);
VirtualFile f = createDirectory("dir");
getVcs().getChangeListInTests().purgeObsolete(0);
List<Revision> rr = getRevisionsFor(f);
assertEquals(1, rr.size());
Revision r = rr.get(0);
assertNull(r.getLabel());
assertNull(r.getChangeSetName());
// directory has no timestamp
assertEquals(-1, r.getTimestamp());
Entry e = r.findEntry();
assertEquals("dir", e.getName());
}
use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.
the class DifferenceReverterTest method revertChange.
private void revertChange(int change, int... diffsIndices) throws IOException {
List<Revision> revs = getRevisionsFor(myRoot);
Revision leftRev = revs.get(change + 1);
Revision rightRev = revs.get(change);
List<Difference> diffs = leftRev.getDifferencesWith(rightRev);
List<Difference> toRevert = new ArrayList<>();
for (int i : diffsIndices) {
toRevert.add(diffs.get(i));
}
if (diffsIndices.length == 0)
toRevert = diffs;
new DifferenceReverter(myProject, getVcs(), myGateway, toRevert, leftRev).revert();
}
use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.
the class SelectionCalculatorTest method testSelectionForVeryOldRevisionTakenBackward.
@Test
public void testSelectionForVeryOldRevisionTakenBackward() throws FilesTooBigForDiffException {
List<Revision> rr = createRevisions("ghi\nabc\ndef", "abc\nghi\ndef", "abc\ndef\nghi");
SelectionCalculator c = new SelectionCalculator(gw, rr, 0, 1);
Block b2 = c.getSelectionFor(rr.get(2), new NullProgress());
Block b1 = c.getSelectionFor(rr.get(1), new NullProgress());
Block b0 = c.getSelectionFor(rr.get(0), new NullProgress());
assertBlock(0, 2, "abc\ndef", b0);
assertBlock(0, 3, "abc\nghi\ndef", b1);
assertBlock(1, 3, "abc\ndef", b2);
}
Aggregations