use of com.google.gerrit.extensions.api.changes.MoveInput in project gerrit by GerritCodeReview.
the class MoveChangeIT method move.
private void move(String changeId, String destination, boolean keepAllVotes) throws RestApiException {
MoveInput in = new MoveInput();
in.destinationBranch = destination;
in.keepAllVotes = keepAllVotes;
gApi.changes().id(changeId).move(in);
}
use of com.google.gerrit.extensions.api.changes.MoveInput in project gerrit by GerritCodeReview.
the class MoveChangeIT method move.
private void move(String changeId, String destination, String message) throws RestApiException {
MoveInput in = new MoveInput();
in.destinationBranch = destination;
in.message = message;
gApi.changes().id(changeId).move(in);
}
use of com.google.gerrit.extensions.api.changes.MoveInput in project gerrit by GerritCodeReview.
the class ReviewCommand method reviewPatchSet.
private void reviewPatchSet(PatchSet patchSet) throws Exception {
ReviewInput review = new ReviewInput();
review.message = Strings.emptyToNull(changeComment);
review.tag = Strings.emptyToNull(changeTag);
review.notify = notify;
review.labels = new TreeMap<>();
review.drafts = ReviewInput.DraftHandling.PUBLISH;
for (LabelSetter setter : optionMap.values()) {
setter.getValue().ifPresent(v -> review.labels.put(setter.getLabelName(), v));
}
review.labels.putAll(customLabels);
// We don't need to add the review comment when abandoning/restoring.
if (abandonChange || restoreChange || moveToBranch != null) {
review.message = null;
}
try {
if (abandonChange) {
AbandonInput input = new AbandonInput();
input.message = Strings.emptyToNull(changeComment);
applyReview(patchSet, review);
changeApi(patchSet).abandon(input);
} else if (restoreChange) {
RestoreInput input = new RestoreInput();
input.message = Strings.emptyToNull(changeComment);
changeApi(patchSet).restore(input);
applyReview(patchSet, review);
} else {
applyReview(patchSet, review);
}
if (moveToBranch != null) {
MoveInput moveInput = new MoveInput();
moveInput.destinationBranch = moveToBranch;
moveInput.message = Strings.emptyToNull(changeComment);
changeApi(patchSet).move(moveInput);
}
if (rebaseChange) {
revisionApi(patchSet).rebase();
}
if (submitChange) {
revisionApi(patchSet).submit();
}
} catch (IllegalStateException | RestApiException e) {
throw die(e);
}
}
use of com.google.gerrit.extensions.api.changes.MoveInput in project gerrit by GerritCodeReview.
the class ChangeApiImpl method move.
@Override
public void move(String destination) throws RestApiException {
MoveInput in = new MoveInput();
in.destinationBranch = destination;
move(in);
}
Aggregations