use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.
the class RevisionsAndDiffsTest method testRevisionForRestoredDirectoryWithRestoreChildren.
public void testRevisionForRestoredDirectoryWithRestoreChildren() throws IOException {
VirtualFile dir = createDirectory("dir");
createFile("dir/f.txt");
delete(dir);
getVcs().beginChangeSet();
dir = createDirectory("dir");
VirtualFile f = createFile("dir/f.txt");
getVcs().endChangeSet(null);
List<Revision> rr = getRevisionsFor(dir);
assertEquals(5, rr.size());
assertEquals(1, rr.get(0).findEntry().getChildren().size());
assertNull(rr.get(1).findEntry());
assertEquals(1, rr.get(2).findEntry().getChildren().size());
assertEquals(0, rr.get(3).findEntry().getChildren().size());
assertEquals(4, getRevisionsFor(f).size());
}
use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.
the class RevisionsAndDiffsTest method testDifferenceForDirectory.
public void testDifferenceForDirectory() throws IOException {
VirtualFile dir = createDirectory("dir");
VirtualFile f = createFile("dir/file.txt");
List<Revision> rr = getRevisionsFor(dir);
assertEquals(3, rr.size());
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("file.txt", d.getRight().getName());
}
use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.
the class RevisionsAndDiffsTest method testNamedAndUnnamedCauseActions.
public void testNamedAndUnnamedCauseActions() throws Exception {
getVcs().beginChangeSet();
VirtualFile f = createFile("file.txt");
getVcs().endChangeSet("name");
setContent(f, "foo");
List<Revision> rr = getRevisionsFor(f);
assertEquals(3, rr.size());
assertNull(rr.get(1).getChangeSetName());
assertEquals("name", rr.get(2).getChangeSetName());
}
use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.
the class RevisionsAndDiffsTest method testRevisionsTimestamp.
public void testRevisionsTimestamp() throws IOException {
Clock.setTime(10);
VirtualFile f = createFile("file1.txt");
Clock.setTime(20);
setContent(f, "a");
Clock.setTime(30);
setContent(f, "b");
List<Revision> rr = getRevisionsFor(f);
assertEquals(30L, rr.get(1).getTimestamp());
assertEquals(20L, rr.get(2).getTimestamp());
assertEquals(10L, rr.get(3).getTimestamp());
}
use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.
the class FileListeningTest method testCreationAndDeletionOfUnversionedFile.
public void testCreationAndDeletionOfUnversionedFile() throws IOException {
addExcludedDir(myRoot.getPath() + "/dir");
Module m = createModule("foo");
addContentRoot(m, myRoot.getPath() + "/dir/subDir");
createFileExternally("dir/subDir/file.txt");
LocalFileSystem.getInstance().refresh(false);
FileUtil.delete(new File(myRoot.getPath() + "/dir"));
LocalFileSystem.getInstance().refresh(false);
createFileExternally("dir/subDir/file.txt");
LocalFileSystem.getInstance().refresh(false);
List<Revision> revs = getRevisionsFor(myRoot);
assertEquals(4, revs.size());
assertNotNull(revs.get(0).findEntry().findEntry("dir/subDir/file.txt"));
assertNull(revs.get(1).findEntry().findEntry("dir/subDir/file.txt"));
assertNotNull(revs.get(2).findEntry().findEntry("dir/subDir/file.txt"));
assertNull(revs.get(3).findEntry().findEntry("dir/subDir/file.txt"));
}
Aggregations