use of com.google.gerrit.acceptance.TestProjectInput in project gerrit by GerritCodeReview.
the class SubmitByRebaseAlwaysIT method submitWithPossibleFastForward.
@Test
@TestProjectInput(useContentMerge = InheritableBoolean.TRUE)
public void submitWithPossibleFastForward() throws Exception {
RevCommit oldHead = getRemoteHead();
PushOneCommit.Result change = createChange();
submit(change.getChangeId());
RevCommit head = getRemoteHead();
assertThat(head.getId()).isNotEqualTo(change.getCommit());
assertThat(head.getParent(0)).isEqualTo(oldHead);
assertApproved(change.getChangeId());
assertCurrentRevision(change.getChangeId(), 2, head);
assertSubmitter(change.getChangeId(), 1);
assertSubmitter(change.getChangeId(), 2);
assertPersonEquals(admin.getIdent(), head.getAuthorIdent());
assertPersonEquals(admin.getIdent(), head.getCommitterIdent());
assertRefUpdatedEvents(oldHead, head);
assertChangeMergedEvents(change.getChangeId(), head.name());
}
use of com.google.gerrit.acceptance.TestProjectInput in project gerrit by GerritCodeReview.
the class SubmitByRebaseAlwaysIT method changeMessageOnSubmit.
@Test
@TestProjectInput(useContentMerge = InheritableBoolean.TRUE)
public void changeMessageOnSubmit() throws Exception {
PushOneCommit.Result change1 = createChange();
PushOneCommit.Result change2 = createChange();
RegistrationHandle handle = changeMessageModifiers.add(new ChangeMessageModifier() {
@Override
public String onSubmit(String newCommitMessage, RevCommit original, RevCommit mergeTip, Branch.NameKey destination) {
List<String> custom = mergeTip.getFooterLines("Custom");
if (!custom.isEmpty()) {
newCommitMessage += "Custom-Parent: " + custom.get(0) + "\n";
}
return newCommitMessage + "Custom: " + destination.get();
}
});
try {
// change1 is a fast-forward, but should be rebased in cherry pick style
// anyway, making change2 not a fast-forward, requiring a rebase.
approve(change1.getChangeId());
submit(change2.getChangeId());
} finally {
handle.remove();
}
// ... but both changes should get custom footers.
assertThat(getCurrentCommit(change1).getFooterLines("Custom")).containsExactly("refs/heads/master");
assertThat(getCurrentCommit(change2).getFooterLines("Custom")).containsExactly("refs/heads/master");
assertThat(getCurrentCommit(change2).getFooterLines("Custom-Parent")).containsExactly("refs/heads/master");
}
Aggregations