use of com.google.gerrit.acceptance.PushOneCommit.Result in project gerrit by GerritCodeReview.
the class AbstractDaemonTest method createMergeCommitChange.
protected PushOneCommit.Result createMergeCommitChange(String ref, String file) throws Exception {
ObjectId initial = repo().exactRef(HEAD).getLeaf().getObjectId();
PushOneCommit.Result p1 = pushFactory.create(admin.newIdent(), testRepo, "parent 1", ImmutableMap.of(file, "foo-1", "bar", "bar-1")).to(ref);
// reset HEAD in order to create a sibling of the first change
testRepo.reset(initial);
PushOneCommit.Result p2 = pushFactory.create(admin.newIdent(), testRepo, "parent 2", ImmutableMap.of(file, "foo-2", "bar", "bar-2")).to(ref);
PushOneCommit m = pushFactory.create(admin.newIdent(), testRepo, "merge", ImmutableMap.of(file, "foo-1", "bar", "bar-2"));
m.setParents(ImmutableList.of(p1.getCommit(), p2.getCommit()));
PushOneCommit.Result result = m.to(ref);
result.assertOkStatus();
return result;
}
use of com.google.gerrit.acceptance.PushOneCommit.Result in project gerrit by GerritCodeReview.
the class AbstractDaemonTest method createChange.
protected PushOneCommit.Result createChange(TestRepository<InMemoryRepository> repo) throws Exception {
PushOneCommit push = pushFactory.create(admin.newIdent(), repo);
PushOneCommit.Result result = push.to("refs/for/master");
result.assertOkStatus();
return result;
}
use of com.google.gerrit.acceptance.PushOneCommit.Result in project gerrit by GerritCodeReview.
the class RevisionDiffIT method diffAgainstAutoMergeCanBeRetrievedForCommitMessageAndMergeList.
@Test
public void diffAgainstAutoMergeCanBeRetrievedForCommitMessageAndMergeList() throws Exception {
PushOneCommit.Result result = createMergeCommitChange("refs/for/master", "my_file.txt");
String changeId = result.getChangeId();
addModifiedPatchSet(changeId, "my_file.txt", content -> content.concat("Line I\nLine II\n"));
DiffInfo commitMessageDiffInfo = getDiffRequest(changeId, CURRENT, COMMIT_MSG).get();
DiffInfo mergeListDiffInfo = getDiffRequest(changeId, CURRENT, MERGE_LIST).get();
assertThat(commitMessageDiffInfo).changeType().isEqualTo(ChangeType.ADDED);
assertThat(commitMessageDiffInfo).content().hasSize(1);
assertThat(mergeListDiffInfo).changeType().isEqualTo(ChangeType.ADDED);
assertThat(mergeListDiffInfo).content().hasSize(1);
assertThat(mergeListDiffInfo).content().element(0).linesOfB().element(0).isEqualTo("Merge List:");
}
use of com.google.gerrit.acceptance.PushOneCommit.Result in project gerrit by GerritCodeReview.
the class PortedCommentsIT method addCommit.
private ObjectId addCommit(ObjectId parentCommit, String fileName, String fileContent) throws Exception {
testRepo.reset(parentCommit);
PushOneCommit push = pushFactory.create(admin.newIdent(), testRepo, "Adjust files of repo", ImmutableMap.of(fileName, fileContent));
PushOneCommit.Result result = push.to("refs/for/master");
return result.getCommit();
}
use of com.google.gerrit.acceptance.PushOneCommit.Result in project gerrit by GerritCodeReview.
the class RevisionDiffIT method diff.
@Test
public void diff() throws Exception {
// The assertions assume that intraline is false.
assume().that(intraline).isFalse();
String fileName = "a_new_file.txt";
String fileContent = "First line\nSecond line\n";
PushOneCommit.Result result = createChange("Add a file", fileName, fileContent);
assertDiffForNewFile(result, fileName, fileContent);
assertDiffForNewFile(result, COMMIT_MSG, result.getCommit().getFullMessage());
}
Aggregations