StoredCommit toCommit = rep.getCommit(toRevisionId);
if (toCommit.getBranchRootId() != null) {
throw new MicroKernelException("branch revisions are not supported: " + toRevisionId);
}
Commit fromCommit;
if (toRevisionId.equals(fromRevisionId)) {
fromCommit = toCommit;
} else {
fromCommit = rep.getCommit(fromRevisionId);
if (fromCommit.getCommitTS() > toCommit.getCommitTS()) {
// negative range, return empty journal
return "[]";
}
}
if (fromCommit.getBranchRootId() != null) {
throw new MicroKernelException("branch revisions are not supported: " + fromRevisionId);
}
// collect commits, starting with toRevisionId
// and traversing parent commit links until we've reached
// fromRevisionId
StoredCommit commit = toCommit;
while (commit != null) {
commits.add(commit);
if (commit.getId().equals(fromRevisionId)) {
break;
}
Id commitId = commit.getParentId();
if (commitId == null) {
// inconsistent revision history, ignore silently...
break;
}
commit = rep.getCommit(commitId);
if (commit.getCommitTS() < fromCommit.getCommitTS()) {
// inconsistent revision history, ignore silently...
break;
}
}
} catch (MicroKernelException e) {