use of com.google.gerrit.acceptance.TestProjectInput in project gerrit by GerritCodeReview.
the class RevisionIT method approvalCopiedDuringSubmitIsNotPostSubmit.
@TestProjectInput(submitType = SubmitType.CHERRY_PICK)
@Test
public void approvalCopiedDuringSubmitIsNotPostSubmit() throws Exception {
PushOneCommit.Result r = createChange();
Change.Id id = r.getChange().getId();
gApi.changes().id(id.get()).current().review(ReviewInput.approve());
gApi.changes().id(id.get()).current().submit();
ChangeData cd = r.getChange();
assertThat(cd.patchSets()).hasSize(2);
PatchSetApproval psa = Iterators.getOnlyElement(cd.currentApprovals().stream().filter(a -> !a.isLegacySubmit()).iterator());
assertThat(psa.getPatchSetId().get()).isEqualTo(2);
assertThat(psa.getLabel()).isEqualTo("Code-Review");
assertThat(psa.getValue()).isEqualTo(2);
assertThat(psa.isPostSubmit()).isFalse();
}
use of com.google.gerrit.acceptance.TestProjectInput in project gerrit by GerritCodeReview.
the class AbstractSubmitByMerge method submitMultipleCommitsToEmptyRepoWithOneMerge.
@Test
@TestProjectInput(createEmptyCommit = false)
public void submitMultipleCommitsToEmptyRepoWithOneMerge() throws Exception {
assume().that(isSubmitWholeTopicEnabled()).isTrue();
PushOneCommit.Result change1 = pushFactory.create(db, admin.getIdent(), testRepo, "Change 1", "a", "a").to("refs/for/master/" + name("topic"));
PushOneCommit push2 = pushFactory.create(db, admin.getIdent(), testRepo, "Change 2", "b", "b");
push2.noParents();
PushOneCommit.Result change2 = push2.to("refs/for/master/" + name("topic"));
change2.assertOkStatus();
approve(change1.getChangeId());
submit(change2.getChangeId());
RevCommit head = getRemoteHead();
assertThat(head.getParents()).hasLength(2);
assertThat(head.getParent(0)).isEqualTo(change1.getCommit());
assertThat(head.getParent(1)).isEqualTo(change2.getCommit());
}
use of com.google.gerrit.acceptance.TestProjectInput in project gerrit by GerritCodeReview.
the class AbstractSubmitByRebase method submitFastForwardIdenticalTree.
@Test
@TestProjectInput(useContentMerge = InheritableBoolean.TRUE)
public void submitFastForwardIdenticalTree() throws Exception {
RevCommit initialHead = getRemoteHead();
PushOneCommit.Result change1 = createChange("Change 1", "a.txt", "a");
PushOneCommit.Result change2 = createChange("Change 2", "a.txt", "a");
assertThat(change1.getCommit().getTree()).isEqualTo(change2.getCommit().getTree());
// for rebase if necessary, otherwise, the manual rebase of change2 will
// fail since change1 would be merged as fast forward
testRepo.reset(initialHead);
PushOneCommit.Result change0 = createChange("Change 0", "b.txt", "b");
submit(change0.getChangeId());
RevCommit headAfterChange0 = getRemoteHead();
assertThat(headAfterChange0.getShortMessage()).isEqualTo("Change 0");
submit(change1.getChangeId());
RevCommit headAfterChange1 = getRemoteHead();
assertThat(headAfterChange1.getShortMessage()).isEqualTo("Change 1");
assertThat(headAfterChange0).isEqualTo(headAfterChange1.getParent(0));
// Do manual rebase first.
gApi.changes().id(change2.getChangeId()).current().rebase();
submit(change2.getChangeId());
RevCommit headAfterChange2 = getRemoteHead();
assertThat(headAfterChange2.getShortMessage()).isEqualTo("Change 2");
assertThat(headAfterChange1).isEqualTo(headAfterChange2.getParent(0));
ChangeInfo info2 = get(change2.getChangeId());
assertThat(info2.status).isEqualTo(ChangeStatus.MERGED);
}
use of com.google.gerrit.acceptance.TestProjectInput in project gerrit by GerritCodeReview.
the class AbstractSubmitByRebase method submitWithContentMerge_Conflict.
@Test
@TestProjectInput(useContentMerge = InheritableBoolean.TRUE)
public void submitWithContentMerge_Conflict() throws Exception {
RevCommit initialHead = getRemoteHead();
PushOneCommit.Result change = createChange("Change 1", "a.txt", "content");
submit(change.getChangeId());
RevCommit headAfterFirstSubmit = getRemoteHead();
testRepo.reset(initialHead);
PushOneCommit.Result change2 = createChange("Change 2", "a.txt", "other content");
submitWithConflict(change2.getChangeId(), "Cannot rebase " + change2.getCommit().name() + ": The change could not be rebased due to a conflict during merge.");
RevCommit head = getRemoteHead();
assertThat(head).isEqualTo(headAfterFirstSubmit);
assertCurrentRevision(change2.getChangeId(), 1, change2.getCommit());
assertNoSubmitter(change2.getChangeId(), 1);
assertRefUpdatedEvents(initialHead, headAfterFirstSubmit);
assertChangeMergedEvents(change.getChangeId(), headAfterFirstSubmit.name());
}
use of com.google.gerrit.acceptance.TestProjectInput in project gerrit by GerritCodeReview.
the class AbstractSubmitByRebase method submitChainFailsOnRework.
@Test
@TestProjectInput(useContentMerge = InheritableBoolean.TRUE)
public void submitChainFailsOnRework() throws Exception {
PushOneCommit.Result change1 = createChange("subject 1", "fileName 1", "content 1");
RevCommit headAfterChange1 = change1.getCommit();
PushOneCommit.Result change2 = createChange("subject 2", "fileName 2", "content 2");
testRepo.reset(headAfterChange1);
change1 = amendChange(change1.getChangeId(), "subject 1 amend", "fileName 2", "rework content 2");
submit(change1.getChangeId());
headAfterChange1 = getRemoteHead();
submitWithConflict(change2.getChangeId(), "Cannot rebase " + change2.getCommit().getName() + ": " + "The change could not be rebased due to a conflict during merge.");
assertThat(getRemoteHead()).isEqualTo(headAfterChange1);
}
Aggregations