} else if (item.equals("commit")) {
ref = rw.parseCommit(ref);
} else if (item.equals("blob")) {
ref = rw.peel(ref);
if (!(ref instanceof RevBlob))
throw new IncorrectObjectTypeException(ref,
Constants.TYPE_BLOB);
} else if (item.equals("")) {
ref = rw.peel(ref);
} else
throw new RevisionSyntaxException(revstr);
else
throw new RevisionSyntaxException(revstr);
break;
default:
ref = rw.parseAny(ref);
if (ref instanceof RevCommit) {
RevCommit commit = ((RevCommit) ref);
if (commit.getParentCount() == 0)
ref = null;
else
ref = commit.getParent(0);
} else
throw new IncorrectObjectTypeException(ref,
Constants.TYPE_COMMIT);
}
} else {
ref = rw.peel(ref);
if (ref instanceof RevCommit) {
RevCommit commit = ((RevCommit) ref);
if (commit.getParentCount() == 0)
ref = null;
else
ref = commit.getParent(0);
} else
throw new IncorrectObjectTypeException(ref,
Constants.TYPE_COMMIT);
}
break;
case '~':
if (ref == null) {
ref = parseSimple(rw, new String(rev, 0, i));
if (ref == null)
return null;
}
ref = rw.peel(ref);
if (!(ref instanceof RevCommit))
throw new IncorrectObjectTypeException(ref,
Constants.TYPE_COMMIT);
int l;
for (l = i + 1; l < rev.length; ++l) {
if (!Character.isDigit(rev[l]))
break;