use of com.google.gitiles.RevisionParser.Result in project gitiles by GerritCodeReview.
the class RevisionParserTest method parseFirstParentExpression.
@Test
public void parseFirstParentExpression() throws Exception {
RevCommit parent = repo.commit().create();
RevCommit commit = repo.branch("master").commit().parent(parent).create();
assertThat(parser.parse("master^!")).isEqualTo(new Result(Revision.peeled("master", commit), Revision.peeled("master^", parent), ""));
assertThat(parser.parse("master^^!")).isEqualTo(new Result(Revision.peeled("master^", parent), Revision.NULL, ""));
assertThat(parser.parse(parent.name() + "^!")).isEqualTo(new Result(Revision.peeled(parent.name(), parent), Revision.NULL, ""));
repo.update("refs/tags/tag", repo.tag("tag", commit));
assertThat(parser.parse("tag^!")).isEqualTo(new Result(Revision.peeled("tag", commit), Revision.peeled("tag^", parent), ""));
assertThat(parser.parse("tag^^!")).isEqualTo(new Result(Revision.peeled("tag^", parent), Revision.NULL, ""));
}