Search in sources :

Example 11 with Result

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, ""));
}
Also used : RevCommit(org.eclipse.jgit.revwalk.RevCommit) Result(com.google.gitiles.RevisionParser.Result) Test(org.junit.Test)

Aggregations

Result (com.google.gitiles.RevisionParser.Result)11 RevCommit (org.eclipse.jgit.revwalk.RevCommit)11 Test (org.junit.Test)11 RevBlob (org.eclipse.jgit.revwalk.RevBlob)1 RevTag (org.eclipse.jgit.revwalk.RevTag)1