use of com.google.gerrit.extensions.common.PureRevertInfo in project gerrit by GerritCodeReview.
the class RevertIT method pureRevertReturnsFalseWithRebaseConflict.
@Test
public void pureRevertReturnsFalseWithRebaseConflict() throws Exception {
// Create an initial commit to serve as claimed original
PushOneCommit.Result r1 = createChange("commit message", "a.txt", "content1");
merge(r1);
String claimedOriginal = projectOperations.project(project).getHead("master").toObjectId().name();
// Change contents of the file to provoke a conflict
merge(createChange("commit message", "a.txt", "content2"));
// Create a commit that we can revert
PushOneCommit.Result r2 = createChange("commit message", "a.txt", "content3");
merge(r2);
// Create a revert of r2
String revertR3Id = gApi.changes().id(r2.getChangeId()).revert().id();
// Assert that the change is a pure revert of it's 'revertOf'
assertThat(gApi.changes().id(revertR3Id).pureRevert().isPureRevert).isTrue();
// Assert that the change is not a pure revert of claimedOriginal because pureRevert is trying
// to rebase this on claimed original, which fails.
PureRevertInfo pureRevert = gApi.changes().id(revertR3Id).pureRevert(claimedOriginal);
assertThat(pureRevert.isPureRevert).isFalse();
}
Aggregations