use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createNewChangeWithChangeId.
@Test
public void createNewChangeWithChangeId() throws Exception {
ChangeInput ci = newChangeInput(ChangeStatus.NEW);
String changeId = "I1234000000000000000000000000000000000000";
String changeIdLine = "Change-Id: " + changeId;
ci.subject = "Subject\n\n" + changeIdLine;
ChangeInfo info = assertCreateSucceeds(ci);
assertThat(info.changeId).isEqualTo(changeId);
assertThat(info.revisions.get(info.currentRevision).commit.message).contains(changeIdLine);
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method onlyContentMerged.
@Test
public void onlyContentMerged() throws Exception {
testRepo.branch("HEAD").commit().insertChangeId().message("first commit").add("a.txt", "a contents ").create();
testRepo.git().push().setRemote("origin").setRefSpecs(new RefSpec("HEAD:refs/heads/master")).call();
// create a change, and cherrypick into master
PushOneCommit.Result cId = createChange();
RevCommit commitId = cId.getCommit();
CherryPickInput cpi = new CherryPickInput();
cpi.destination = "master";
cpi.message = "cherry pick the commit";
ChangeApi orig = gApi.changes().id(cId.getChangeId());
ChangeApi cherry = orig.current().cherryPick(cpi);
cherry.current().review(ReviewInput.approve());
cherry.current().submit();
ObjectId remoteId = projectOperations.project(project).getHead("master");
assertThat(remoteId).isNotEqualTo(commitId);
ChangeInput in = newMergeChangeInput("master", commitId.getName(), "");
assertCreateSucceeds(in);
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createChangeWithParentCommitWithNonExistingTargetBranch.
@Test
public void createChangeWithParentCommitWithNonExistingTargetBranch() throws Exception {
Result initialCommit = pushFactory.create(user.newIdent(), testRepo, "initial commit", "readme.txt", "initial commit").to("refs/heads/master");
initialCommit.assertOkStatus();
ChangeInput input = newChangeInput(ChangeStatus.NEW);
input.branch = "non-existing";
input.baseCommit = initialCommit.getCommit().getName();
assertCreateFails(input, BadRequestException.class, "Destination branch does not exist");
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createEmptyChange_InvalidStatus.
@Test
public void createEmptyChange_InvalidStatus() throws Exception {
ChangeInput ci = newChangeInput(ChangeStatus.MERGED);
assertCreateFails(ci, BadRequestException.class, "unsupported change status");
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method invalidSource.
@Test
public void invalidSource() throws Exception {
changeInTwoBranches("branchA", "a.txt", "branchB", "b.txt");
ChangeInput in = newMergeChangeInput("branchA", "invalid", "");
assertCreateFails(in, BadRequestException.class, "Cannot resolve 'invalid' to a commit");
}
Aggregations