summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2011-06-07 10:10:36 -0700
committerShawn O. Pearce <sop@google.com>2011-06-07 10:10:39 -0700
commite313242c05197c6f8a62e44415e578e340962822 (patch)
tree26f3a2001f5c4425314f3c782f2e6bc981840569
parent40d2020668c7facb5f78d47540dcb1260074497b (diff)
Fix API breakage on ChangeDetailService
The Mylyn Reviews project pointed out Gerrit changed the API signature of a JSON method they use remotely. Fix the API back to the original signature, and define a new method with the extra arguments. Change-Id: I51cbbdd64bdb72a666a6b5266db3b93494b75182 Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r--gerrit-common/src/main/java/com/google/gerrit/common/data/ChangeDetailService.java4
-rw-r--r--gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchSetComplexDisclosurePanel.java4
-rw-r--r--gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchScreen.java6
-rw-r--r--gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/ChangeDetailServiceImpl.java12
-rw-r--r--gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/PatchSetDetailFactory.java16
5 files changed, 25 insertions, 17 deletions
diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/ChangeDetailService.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/ChangeDetailService.java
index 621f52df3a..2fbda21af9 100644
--- a/gerrit-common/src/main/java/com/google/gerrit/common/data/ChangeDetailService.java
+++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/ChangeDetailService.java
@@ -29,7 +29,9 @@ public interface ChangeDetailService extends RemoteJsonService {
void includedInDetail(Change.Id id, AsyncCallback<IncludedInDetail> callback);
- void patchSetDetail(PatchSet.Id keyA, PatchSet.Id keyB,
+ void patchSetDetail(PatchSet.Id key, AsyncCallback<PatchSetDetail> callback);
+
+ void patchSetDetail2(PatchSet.Id baseId, PatchSet.Id key,
AccountDiffPreference diffPrefs, AsyncCallback<PatchSetDetail> callback);
@SignInRequired
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchSetComplexDisclosurePanel.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchSetComplexDisclosurePanel.java
index 364d710c5f..740e08ce97 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchSetComplexDisclosurePanel.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchSetComplexDisclosurePanel.java
@@ -539,7 +539,7 @@ class PatchSetComplexDisclosurePanel extends ComplexDisclosurePanel implements O
diffPrefs = patchTable.getPreferences().get();
}
- Util.DETAIL_SVC.patchSetDetail(patchSet.getId(), diffBaseId, diffPrefs,
+ Util.DETAIL_SVC.patchSetDetail2(diffBaseId, patchSet.getId(), diffPrefs,
new GerritCallback<PatchSetDetail>() {
@Override
public void onSuccess(PatchSetDetail result) {
@@ -575,7 +575,7 @@ class PatchSetComplexDisclosurePanel extends ComplexDisclosurePanel implements O
diffPrefs = new ListenableAccountDiffPreference().get();
}
- Util.DETAIL_SVC.patchSetDetail(patchSet.getId(), diffBaseId, diffPrefs,
+ Util.DETAIL_SVC.patchSetDetail2(diffBaseId, patchSet.getId(), diffPrefs,
new GerritCallback<PatchSetDetail>() {
public void onSuccess(final PatchSetDetail result) {
ensureLoaded(result);
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchScreen.java
index c815097e16..736d1f012e 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchScreen.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchScreen.java
@@ -320,7 +320,7 @@ public abstract class PatchScreen extends Screen implements
protected void onLoad() {
super.onLoad();
if (patchSetDetail == null) {
- Util.DETAIL_SVC.patchSetDetail(idSideB, null, null,
+ Util.DETAIL_SVC.patchSetDetail(idSideB,
new GerritCallback<PatchSetDetail>() {
@Override
public void onSuccess(PatchSetDetail result) {
@@ -403,7 +403,7 @@ public abstract class PatchScreen extends Screen implements
commitMessageBlock.display(patchSetDetail.getInfo().getMessage());
} else {
commitMessageBlock.setVisible(false);
- Util.DETAIL_SVC.patchSetDetail(idSideB, null, null,
+ Util.DETAIL_SVC.patchSetDetail(idSideB,
new GerritCallback<PatchSetDetail>() {
@Override
public void onSuccess(PatchSetDetail result) {
@@ -500,7 +500,7 @@ public abstract class PatchScreen extends Screen implements
final PatchSet.Id psid = patchKey.getParentKey();
fileList = new PatchTable(prefs);
fileList.setSavePointerId("PatchTable " + psid);
- Util.DETAIL_SVC.patchSetDetail(psid, null, null,
+ Util.DETAIL_SVC.patchSetDetail(psid,
new GerritCallback<PatchSetDetail>() {
public void onSuccess(final PatchSetDetail result) {
fileList.display(result);
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/ChangeDetailServiceImpl.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/ChangeDetailServiceImpl.java
index f131123bab..fa0579e3d8 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/ChangeDetailServiceImpl.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/ChangeDetailServiceImpl.java
@@ -52,10 +52,14 @@ class ChangeDetailServiceImpl implements ChangeDetailService {
includedInDetail.create(id).to(callback);
}
- public void patchSetDetail(final PatchSet.Id idA, final PatchSet.Id idB,
- final AccountDiffPreference diffPrefs,
- final AsyncCallback<PatchSetDetail> callback) {
- patchSetDetail.create(idA, idB, diffPrefs).to(callback);
+ public void patchSetDetail(PatchSet.Id id,
+ AsyncCallback<PatchSetDetail> callback) {
+ patchSetDetail2(null, id, null, callback);
+ }
+
+ public void patchSetDetail2(PatchSet.Id baseId, PatchSet.Id id,
+ AccountDiffPreference diffPrefs, AsyncCallback<PatchSetDetail> callback) {
+ patchSetDetail.create(baseId, id, diffPrefs).to(callback);
}
public void patchSetPublishDetail(final PatchSet.Id id,
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/PatchSetDetailFactory.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/PatchSetDetailFactory.java
index 6865b2b0e7..f478d667a6 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/PatchSetDetailFactory.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/PatchSetDetailFactory.java
@@ -56,8 +56,10 @@ class PatchSetDetailFactory extends Handler<PatchSetDetail> {
LoggerFactory.getLogger(PatchSetDetailFactory.class);
interface Factory {
- PatchSetDetailFactory create(@Assisted("psIdNew") PatchSet.Id psIdA,
- @Assisted("psIdOld") PatchSet.Id psIdB, AccountDiffPreference diffPrefs);
+ PatchSetDetailFactory create(
+ @Assisted("psIdBase") @Nullable PatchSet.Id psIdBase,
+ @Assisted("psIdNew") PatchSet.Id psIdNew,
+ @Nullable AccountDiffPreference diffPrefs);
}
private final PatchSetInfoFactory infoFactory;
@@ -66,8 +68,8 @@ class PatchSetDetailFactory extends Handler<PatchSetDetail> {
private final ChangeControl.Factory changeControlFactory;
private Project.NameKey projectKey;
+ private final PatchSet.Id psIdBase;
private final PatchSet.Id psIdNew;
- private final PatchSet.Id psIdOld;
private final AccountDiffPreference diffPrefs;
private ObjectId oldId;
private ObjectId newId;
@@ -80,16 +82,16 @@ class PatchSetDetailFactory extends Handler<PatchSetDetail> {
PatchSetDetailFactory(final PatchSetInfoFactory psif, final ReviewDb db,
final PatchListCache patchListCache,
final ChangeControl.Factory changeControlFactory,
+ @Assisted("psIdBase") @Nullable final PatchSet.Id psIdBase,
@Assisted("psIdNew") final PatchSet.Id psIdNew,
- @Assisted("psIdOld") @Nullable final PatchSet.Id psIdOld,
@Assisted @Nullable final AccountDiffPreference diffPrefs) {
this.infoFactory = psif;
this.db = db;
this.patchListCache = patchListCache;
this.changeControlFactory = changeControlFactory;
+ this.psIdBase = psIdBase;
this.psIdNew = psIdNew;
- this.psIdOld = psIdOld;
this.diffPrefs = diffPrefs;
}
@@ -106,9 +108,9 @@ class PatchSetDetailFactory extends Handler<PatchSetDetail> {
final PatchList list;
- if (psIdOld != null) {
+ if (psIdBase != null) {
+ oldId = toObjectId(psIdBase);
newId = toObjectId(psIdNew);
- oldId = psIdOld != null ? toObjectId(psIdOld) : null;
projectKey = control.getProject().getNameKey();