use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.
the class ActionsTest method testActionInsideCommandSurroundedWithSomeChanges.
public void testActionInsideCommandSurroundedWithSomeChanges() throws Exception {
// see testActionInsideCommand comment
final VirtualFile f = createFile("f.txt");
CommandProcessor.getInstance().executeCommand(myProject, new RunnableAdapter() {
@Override
public void doRun() throws IOException {
setContent(f, "file");
setDocumentTextFor(f, "doc1");
LocalHistoryAction a = LocalHistory.getInstance().startAction("action");
setDocumentTextFor(f, "doc2");
a.finish();
saveDocument(f);
setContent(f, "doc3");
}
}, "command", null);
List<Revision> rr = getRevisionsFor(f);
assertEquals(4, rr.size());
assertContent("doc3", rr.get(0).findEntry());
assertContent("doc1", rr.get(1).findEntry());
assertContent("", rr.get(2).findEntry());
assertEquals("command", rr.get(1).getChangeSetName());
assertNull(rr.get(2).getChangeSetName());
}
use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.
the class BasicsTest method testPuttingSystemLabel.
public void testPuttingSystemLabel() throws IOException {
VirtualFile f = createChildData(myRoot, "file.txt");
assertEquals(2, getRevisionsFor(f).size());
assertEquals(2, getRevisionsFor(myRoot).size());
LocalHistory.getInstance().putSystemLabel(myProject, "label");
List<Revision> rr = getRevisionsFor(f);
assertEquals(3, rr.size());
assertEquals("label", rr.get(1).getLabel());
rr = getRevisionsFor(myRoot);
assertEquals(3, rr.size());
assertEquals("label", rr.get(1).getLabel());
}
use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.
the class BasicsTest method testPuttingUserLabel.
public void testPuttingUserLabel() throws Exception {
VirtualFile f = createChildData(myRoot, "f.txt");
LocalHistory.getInstance().putUserLabel(myProject, "global");
assertEquals(3, getRevisionsFor(f).size());
assertEquals(3, getRevisionsFor(myRoot).size());
LocalHistory.getInstance().putUserLabel(myProject, "file");
List<Revision> rr = getRevisionsFor(f);
assertEquals(4, rr.size());
assertEquals("file", rr.get(1).getLabel());
assertEquals(-1, rr.get(1).getLabelColor());
assertEquals("global", rr.get(2).getLabel());
assertEquals(-1, rr.get(2).getLabelColor());
}
use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.
the class BasicsTest method testPuttingLabelWithUnsavedDocuments.
public void testPuttingLabelWithUnsavedDocuments() throws Exception {
VirtualFile f = createChildData(myRoot, "f.txt");
setContent(f, "1");
setDocumentTextFor(f, "2");
LocalHistory.getInstance().putSystemLabel(myProject, "label");
setDocumentTextFor(f, "3");
LocalHistory.getInstance().putUserLabel(myProject, "label");
setDocumentTextFor(f, "4");
LocalHistory.getInstance().putUserLabel(myProject, "label");
List<Revision> rr = getRevisionsFor(f);
// 5 changes + 3 labels
assertEquals(9, rr.size());
assertEquals("4", new String(rr.get(0).findEntry().getContent().getBytes()));
assertEquals("4", new String(rr.get(1).findEntry().getContent().getBytes()));
assertEquals("3", new String(rr.get(2).findEntry().getContent().getBytes()));
assertEquals("3", new String(rr.get(3).findEntry().getContent().getBytes()));
assertEquals("2", new String(rr.get(4).findEntry().getContent().getBytes()));
assertEquals("2", new String(rr.get(5).findEntry().getContent().getBytes()));
assertEquals("1", new String(rr.get(6).findEntry().getContent().getBytes()));
assertEquals("", new String(rr.get(7).findEntry().getContent().getBytes()));
}
use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.
the class PurgingTest method testLabelsAfterPurge.
@Test
public void testLabelsAfterPurge() throws IOException {
Clock.setTime(1);
VirtualFile file = createFile("file");
Clock.setTime(2);
LocalHistory.getInstance().putUserLabel(myProject, "1");
getVcs().getChangeListInTests().purgeObsolete(1);
List<Revision> rr = getRevisionsFor(file);
assertEquals(2, rr.size());
assertEquals("1", rr.get(1).getLabel());
}
Aggregations