Remove old rebaseChange RPC

Change-Id: Ieb55dd1c01f1161649400a375119bdd89ec50330
This commit is contained in:
David Ostrovsky
2013-12-07 00:28:50 +01:00
parent 68b7449da7
commit a15cfff1b2
6 changed files with 7 additions and 143 deletions

View File

@@ -1,30 +0,0 @@
// Copyright (C) 2009 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.common.data;
import com.google.gerrit.common.audit.Audit;
import com.google.gerrit.common.auth.SignInRequired;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gwtjsonrpc.common.AsyncCallback;
import com.google.gwtjsonrpc.common.RemoteJsonService;
import com.google.gwtjsonrpc.common.RpcImpl;
import com.google.gwtjsonrpc.common.RpcImpl.Version;
@RpcImpl(version = Version.V2_0)
public interface ChangeManageService extends RemoteJsonService {
@Audit
@SignInRequired
void rebaseChange(PatchSet.Id patchSetId, AsyncCallback<ChangeDetail> callback);
}

View File

@@ -543,8 +543,13 @@ class PatchSetComplexDisclosurePanel extends ComplexDisclosurePanel
@Override @Override
public void onClick(final ClickEvent event) { public void onClick(final ClickEvent event) {
b.setEnabled(false); b.setEnabled(false);
Util.MANAGE_SVC.rebaseChange(patchSet.getId(), final Change.Id id = patchSet.getId().getParentKey();
new ChangeDetailCache.GerritWidgetCallback(b)); ChangeApi.rebase(id.get(), patchSet.getRevision().get(),
new GerritCallback<ChangeInfo>() {
public void onSuccess(ChangeInfo result) {
Gerrit.display(PageLinks.toChange(id));
}
});
} }
}); });
actionsPanel.add(b); actionsPanel.add(b);

View File

@@ -15,7 +15,6 @@
package com.google.gerrit.client.changes; package com.google.gerrit.client.changes;
import com.google.gerrit.common.data.ChangeDetailService; import com.google.gerrit.common.data.ChangeDetailService;
import com.google.gerrit.common.data.ChangeManageService;
import com.google.gerrit.reviewdb.client.Change; import com.google.gerrit.reviewdb.client.Change;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwtjsonrpc.client.JsonUtil; import com.google.gwtjsonrpc.client.JsonUtil;
@@ -26,7 +25,6 @@ public class Util {
public static final ChangeResources R = GWT.create(ChangeResources.class); public static final ChangeResources R = GWT.create(ChangeResources.class);
public static final ChangeDetailService DETAIL_SVC; public static final ChangeDetailService DETAIL_SVC;
public static final ChangeManageService MANAGE_SVC;
private static final int SUBJECT_MAX_LENGTH = 80; private static final int SUBJECT_MAX_LENGTH = 80;
private static final String SUBJECT_CROP_APPENDIX = "..."; private static final String SUBJECT_CROP_APPENDIX = "...";
@@ -35,9 +33,6 @@ public class Util {
static { static {
DETAIL_SVC = GWT.create(ChangeDetailService.class); DETAIL_SVC = GWT.create(ChangeDetailService.class);
JsonUtil.bind(DETAIL_SVC, "rpc/ChangeDetailService"); JsonUtil.bind(DETAIL_SVC, "rpc/ChangeDetailService");
MANAGE_SVC = GWT.create(ChangeManageService.class);
JsonUtil.bind(MANAGE_SVC, "rpc/ChangeManageService");
} }
public static String toLongString(final Change.Status status) { public static String toLongString(final Change.Status status) {

View File

@@ -1,36 +0,0 @@
// Copyright (C) 2009 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.httpd.rpc.changedetail;
import com.google.gerrit.common.data.ChangeDetail;
import com.google.gerrit.common.data.ChangeManageService;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gwtjsonrpc.common.AsyncCallback;
import com.google.inject.Inject;
class ChangeManageServiceImpl implements ChangeManageService {
private final RebaseChangeHandler.Factory rebaseChangeFactory;
@Inject
ChangeManageServiceImpl(
final RebaseChangeHandler.Factory rebaseChangeFactory) {
this.rebaseChangeFactory = rebaseChangeFactory;
}
public void rebaseChange(final PatchSet.Id patchSetId,
final AsyncCallback<ChangeDetail> callback) {
rebaseChangeFactory.create(patchSetId).to(callback);
}
}

View File

@@ -28,7 +28,6 @@ public class ChangeModule extends RpcServletModule {
install(new FactoryModule() { install(new FactoryModule() {
@Override @Override
protected void configure() { protected void configure() {
factory(RebaseChangeHandler.Factory.class);
factory(ChangeDetailFactory.Factory.class); factory(ChangeDetailFactory.Factory.class);
factory(IncludedInDetailFactory.Factory.class); factory(IncludedInDetailFactory.Factory.class);
factory(PatchSetDetailFactory.Factory.class); factory(PatchSetDetailFactory.Factory.class);
@@ -36,6 +35,5 @@ public class ChangeModule extends RpcServletModule {
} }
}); });
rpc(ChangeDetailServiceImpl.class); rpc(ChangeDetailServiceImpl.class);
rpc(ChangeManageServiceImpl.class);
} }
} }

View File

@@ -1,68 +0,0 @@
// Copyright (C) 2012 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.httpd.rpc.changedetail;
import com.google.gerrit.common.data.ChangeDetail;
import com.google.gerrit.common.errors.EmailException;
import com.google.gerrit.common.errors.NoSuchEntityException;
import com.google.gerrit.httpd.rpc.Handler;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.changedetail.RebaseChange;
import com.google.gerrit.server.patch.PatchSetInfoNotAvailableException;
import com.google.gerrit.server.project.InvalidChangeOperationException;
import com.google.gerrit.server.project.NoSuchChangeException;
import com.google.gerrit.server.project.NoSuchProjectException;
import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import java.io.IOException;
class RebaseChangeHandler extends Handler<ChangeDetail> {
interface Factory {
RebaseChangeHandler create(PatchSet.Id patchSetId);
}
private final RebaseChange rebaseChange;
private final IdentifiedUser currentUser;
private final ChangeDetailFactory.Factory changeDetailFactory;
private final PatchSet.Id patchSetId;
@Inject
RebaseChangeHandler(final RebaseChange rebaseChange,
final IdentifiedUser currentUser,
final ChangeDetailFactory.Factory changeDetailFactory,
@Assisted final PatchSet.Id patchSetId) {
this.rebaseChange = rebaseChange;
this.currentUser = currentUser;
this.changeDetailFactory = changeDetailFactory;
this.patchSetId = patchSetId;
}
@Override
public ChangeDetail call() throws NoSuchChangeException, OrmException,
EmailException, NoSuchEntityException, PatchSetInfoNotAvailableException,
MissingObjectException, IncorrectObjectTypeException, IOException,
InvalidChangeOperationException, NoSuchProjectException {
rebaseChange.rebase(patchSetId, currentUser);
return changeDetailFactory.create(patchSetId.getParentKey()).call();
}
}