use of com.google.gerrit.acceptance.TestProjectInput in project gerrit by GerritCodeReview.
the class AbstractSubmitByRebase method submitWithRebaseWithoutAddPatchSetPermission.
@Test
@TestProjectInput(useContentMerge = InheritableBoolean.TRUE)
public void submitWithRebaseWithoutAddPatchSetPermission() throws Exception {
ProjectConfig cfg = projectCache.checkedGet(project).getConfig();
Util.block(cfg, Permission.ADD_PATCH_SET, REGISTERED_USERS, "refs/*");
Util.allow(cfg, Permission.SUBMIT, REGISTERED_USERS, "refs/heads/*");
Util.allow(cfg, Permission.forLabel(Util.codeReview().getName()), -2, 2, REGISTERED_USERS, "refs/heads/*");
saveProjectConfig(project, cfg);
submitWithRebase(user);
}
use of com.google.gerrit.acceptance.TestProjectInput in project gerrit by GerritCodeReview.
the class SubmitByCherryPickIT method submitIdenticalTree.
@Test
@TestProjectInput(useContentMerge = InheritableBoolean.TRUE)
public void submitIdenticalTree() throws Exception {
RevCommit initialHead = getRemoteHead();
PushOneCommit.Result change1 = createChange("Change 1", "a.txt", "a");
testRepo.reset(initialHead);
PushOneCommit.Result change2 = createChange("Change 2", "a.txt", "a");
submit(change1.getChangeId());
RevCommit headAfterFirstSubmit = getRemoteHead();
assertThat(headAfterFirstSubmit.getShortMessage()).isEqualTo("Change 1");
submit(change2.getChangeId(), new SubmitInput(), null, null);
assertThat(getRemoteHead()).isEqualTo(headAfterFirstSubmit);
ChangeInfo info2 = get(change2.getChangeId());
assertThat(info2.status).isEqualTo(ChangeStatus.MERGED);
assertThat(Iterables.getLast(info2.messages).message).isEqualTo(CommitMergeStatus.SKIPPED_IDENTICAL_TREE.getMessage());
assertRefUpdatedEvents(initialHead, headAfterFirstSubmit);
assertChangeMergedEvents(change1.getChangeId(), headAfterFirstSubmit.name(), change2.getChangeId(), headAfterFirstSubmit.name());
}
use of com.google.gerrit.acceptance.TestProjectInput in project gerrit by GerritCodeReview.
the class SubmitByCherryPickIT 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 newHead = getRemoteHead();
testRepo.reset(initialHead);
PushOneCommit.Result change2 = createChange("Change 2", "a.txt", "other content");
submitWithConflict(change2.getChangeId(), "Failed to submit 1 change due to the following problems:\n" + "Change " + change2.getChange().getId() + ": Change could not be " + "merged due to a path conflict. Please rebase the change locally and " + "upload the rebased commit for review.");
assertThat(getRemoteHead()).isEqualTo(newHead);
assertCurrentRevision(change2.getChangeId(), 1, change2.getCommit());
assertNoSubmitter(change2.getChangeId(), 1);
assertRefUpdatedEvents(initialHead, newHead);
assertChangeMergedEvents(change.getChangeId(), newHead.name());
}
use of com.google.gerrit.acceptance.TestProjectInput in project gerrit by GerritCodeReview.
the class SubmitByRebaseIfNecessaryIT method submitWithContentMerge.
@Test
@TestProjectInput(useContentMerge = InheritableBoolean.TRUE)
public void submitWithContentMerge() throws Exception {
RevCommit initialHead = getRemoteHead();
PushOneCommit.Result change = createChange("Change 1", "a.txt", "aaa\nbbb\nccc\n");
submit(change.getChangeId());
RevCommit headAfterFirstSubmit = getRemoteHead();
PushOneCommit.Result change2 = createChange("Change 2", "a.txt", "aaa\nbbb\nccc\nddd\n");
submit(change2.getChangeId());
RevCommit headAfterSecondSubmit = getRemoteHead();
testRepo.reset(change.getCommit());
PushOneCommit.Result change3 = createChange("Change 3", "a.txt", "bbb\nccc\n");
submit(change3.getChangeId());
assertRebase(testRepo, true);
RevCommit headAfterThirdSubmit = getRemoteHead();
assertThat(headAfterThirdSubmit.getParent(0)).isEqualTo(headAfterSecondSubmit);
assertApproved(change3.getChangeId());
assertCurrentRevision(change3.getChangeId(), 2, headAfterThirdSubmit);
assertSubmitter(change3.getChangeId(), 1);
assertSubmitter(change3.getChangeId(), 2);
assertRefUpdatedEvents(initialHead, headAfterFirstSubmit, headAfterFirstSubmit, headAfterSecondSubmit, headAfterSecondSubmit, headAfterThirdSubmit);
assertChangeMergedEvents(change.getChangeId(), headAfterFirstSubmit.name(), change2.getChangeId(), headAfterSecondSubmit.name(), change3.getChangeId(), headAfterThirdSubmit.name());
}
use of com.google.gerrit.acceptance.TestProjectInput in project gerrit by GerritCodeReview.
the class SubmitByCherryPickIT method submitWithContentMerge.
@Test
@TestProjectInput(useContentMerge = InheritableBoolean.TRUE)
public void submitWithContentMerge() throws Exception {
RevCommit initialHead = getRemoteHead();
PushOneCommit.Result change = createChange("Change 1", "a.txt", "aaa\nbbb\nccc\n");
submit(change.getChangeId());
RevCommit headAfterFirstSubmit = getRemoteHead();
PushOneCommit.Result change2 = createChange("Change 2", "a.txt", "aaa\nbbb\nccc\nddd\n");
submit(change2.getChangeId());
RevCommit headAfterSecondSubmit = getRemoteHead();
testRepo.reset(change.getCommit());
PushOneCommit.Result change3 = createChange("Change 3", "a.txt", "bbb\nccc\n");
submit(change3.getChangeId());
assertCherryPick(testRepo, true);
RevCommit headAfterThirdSubmit = getRemoteHead();
assertThat(headAfterThirdSubmit.getParent(0)).isEqualTo(headAfterSecondSubmit);
assertApproved(change3.getChangeId());
assertCurrentRevision(change3.getChangeId(), 2, headAfterThirdSubmit);
assertSubmitter(change2.getChangeId(), 1);
assertSubmitter(change2.getChangeId(), 2);
assertRefUpdatedEvents(initialHead, headAfterFirstSubmit, headAfterFirstSubmit, headAfterSecondSubmit, headAfterSecondSubmit, headAfterThirdSubmit);
assertChangeMergedEvents(change.getChangeId(), headAfterFirstSubmit.name(), change2.getChangeId(), headAfterSecondSubmit.name(), change3.getChangeId(), headAfterThirdSubmit.name());
}
Aggregations