Add REST API for /restore
Changes can be restored via REST api. The web UI now uses this API, and the ssh command line uses the same backend. Change-Id: I7a7e8706a52289f87ace5a60ef3bcd6dd2a2dbde
This commit is contained in:
committed by
Shawn O. Pearce
parent
aab01c4701
commit
117a39b316
@@ -31,6 +31,13 @@ public class ChangeApi {
|
||||
api(id, "abandon").data(input).post(cb);
|
||||
}
|
||||
|
||||
/** Restore a previously abandoned change to be open again. */
|
||||
public static void restore(int id, String msg, AsyncCallback<ChangeInfo> cb) {
|
||||
Input input = Input.create();
|
||||
input.message(emptyToNull(msg));
|
||||
api(id, "restore").data(input).post(cb);
|
||||
}
|
||||
|
||||
/** Create a new change that reverts the delta caused by this change. */
|
||||
public static void revert(int id, String msg, AsyncCallback<ChangeInfo> cb) {
|
||||
Input input = Input.create();
|
||||
|
||||
@@ -605,8 +605,22 @@ class PatchSetComplexDisclosurePanel extends ComplexDisclosurePanel
|
||||
|
||||
@Override
|
||||
public void onSend() {
|
||||
Util.MANAGE_SVC.restoreChange(patchSet.getId(), getMessageText(),
|
||||
createCallback());
|
||||
ChangeApi.restore(changeDetail.getChange().getChangeId(),
|
||||
getMessageText(), new AsyncCallback<ChangeInfo>() {
|
||||
@Override
|
||||
public void onSuccess(ChangeInfo result) {
|
||||
sent = true;
|
||||
Gerrit.display(PageLinks.toChange(new Change.Id(result
|
||||
._number())));
|
||||
hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
enableButtons(true);
|
||||
new ErrorDialog(caught.getMessage()).center();
|
||||
}
|
||||
});
|
||||
}
|
||||
}.center();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user