List<StoredCommit> commits = new ArrayList<StoredCommit>();
try {
StoredCommit toCommit = rep.getCommit(toRevisionId);
Commit fromCommit;
if (toRevisionId.equals(fromRevisionId)) {
fromCommit = toCommit;
} else {
fromCommit = rep.getCommit(fromRevisionId);
}
if (fromCommit.getBranchRootId() != null) {
if (!fromCommit.getBranchRootId().equals(toCommit.getBranchRootId())) {
throw new MicroKernelException("inconsistent range specified: fromRevision denotes a private branch while toRevision denotes a head or another private branch");
}
}
if (fromCommit.getCommitTS() > toCommit.getCommitTS()) {
// negative range, return empty journal
return "[]";
}
// 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) {