}
private String getJournal() {
if (journalRevision == null) {
String revs = mk.getRevisionHistory(0, 1);
JsopTokenizer t = new JsopTokenizer(revs);
t.read('[');
do {
t.read('{');
Assert.assertEquals("id", t.readString());
t.read(':');
journalRevision = t.readString();
t.read(',');
Assert.assertEquals("ts", t.readString());
t.read(':');
t.read(JsopReader.NUMBER);
t.read(',');
Assert.assertEquals("msg", t.readString());
t.read(':');
t.read();
t.read('}');
} while (t.matches(','));
}
String head = mk.getHeadRevision();
String journal = mk.getJournal(journalRevision, head, null);
JsopTokenizer t = new JsopTokenizer(journal);
StringBuilder buff = new StringBuilder();
t.read('[');
boolean isNew = false;
do {
t.read('{');
Assert.assertEquals("id", t.readString());
t.read(':');
t.readString();
t.read(',');
Assert.assertEquals("ts", t.readString());
t.read(':');
t.read(JsopReader.NUMBER);
t.read(',');
Assert.assertEquals("msg", t.readString());
t.read(':');
t.read();
t.read(',');
Assert.assertEquals("changes", t.readString());
t.read(':');
String changes = t.readString().trim();
if (isNew) {
if (buff.length() > 0) {
buff.append('\n');
}
buff.append(changes);
}
// the first revision isn't new, all others are
isNew = true;
t.read('}');
} while (t.matches(','));
journalRevision = head;
return buff.toString();
}