use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CommentContextIT method createChangeInNewBranch.
private ChangeInfo createChangeInNewBranch(String branchName) throws Exception {
ChangeInput in = new ChangeInput();
in.project = project.get();
in.branch = branchName;
in.newBranch = true;
in.subject = "New changes";
return gApi.changes().create(in).get();
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class AbstractQueryChangesTest method revertOf.
@Test
public void revertOf() throws Exception {
TestRepository<Repo> repo = createProject("repo");
// Create two commits and revert second commit (initial commit can't be reverted)
Change initial = insert(repo, newChange(repo));
gApi.changes().id(initial.getChangeId()).current().review(ReviewInput.approve());
gApi.changes().id(initial.getChangeId()).current().submit();
ChangeInfo changeToRevert = gApi.changes().create(new ChangeInput("repo", "master", "commit to revert")).get();
gApi.changes().id(changeToRevert.id).current().review(ReviewInput.approve());
gApi.changes().id(changeToRevert.id).current().submit();
ChangeInfo changeThatReverts = gApi.changes().id(changeToRevert.id).revert().get();
assertQueryByIds("revertof:" + changeToRevert._number, Change.id(changeThatReverts._number));
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class AbstractQueryChangesTest method isPureRevert.
@Test
public void isPureRevert() throws Exception {
assume().that(getSchema().hasField(ChangeField.IS_PURE_REVERT)).isTrue();
TestRepository<Repo> repo = createProject("repo");
// Create two commits and revert second commit (initial commit can't be reverted)
Change initial = insert(repo, newChange(repo));
gApi.changes().id(initial.getChangeId()).current().review(ReviewInput.approve());
gApi.changes().id(initial.getChangeId()).current().submit();
ChangeInfo changeToRevert = gApi.changes().create(new ChangeInput("repo", "master", "commit to revert")).get();
gApi.changes().id(changeToRevert.id).current().review(ReviewInput.approve());
gApi.changes().id(changeToRevert.id).current().submit();
ChangeInfo changeThatReverts = gApi.changes().id(changeToRevert.id).revert().get();
Change.Id changeThatRevertsId = Change.id(changeThatReverts._number);
assertQueryByIds("is:pure-revert", changeThatRevertsId);
// Update the change that reverts such that it's not a pure revert
gApi.changes().id(changeThatReverts.id).edit().modifyFile("some-file.txt", RawInputUtil.create("newcontent".getBytes(UTF_8)));
gApi.changes().id(changeThatReverts.id).edit().publish();
assertQueryByIds("is:pure-revert");
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class AbstractQueryAccountsTest method createChange.
protected ChangeInfo createChange(Project.NameKey project) throws RestApiException {
ChangeInput in = new ChangeInput();
in.subject = "A change";
in.project = project.get();
in.branch = "master";
return gApi.changes().create(in).get();
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createNewDraftChangeNotAllowed.
@Test
public void createNewDraftChangeNotAllowed() throws Exception {
assume().that(isAllowDrafts()).isFalse();
ChangeInput ci = newChangeInput(ChangeStatus.DRAFT);
assertCreateFails(ci, MethodNotAllowedException.class, "draft workflow is disabled");
}
Aggregations