Merge "SideBySide2: Respect base diff revision for files REST call"

This commit is contained in:
Shawn Pearce
2014-01-27 23:39:36 +00:00
committed by Gerrit Code Review
2 changed files with 10 additions and 3 deletions

View File

@@ -35,6 +35,15 @@ public class DiffApi {
api.get(NativeMap.copyKeysIntoChildren("path", cb));
}
public static void list(PatchSet.Id id, PatchSet.Id base,
AsyncCallback<NativeMap<FileInfo>> cb) {
RestApi api = ChangeApi.revision(id).view("files");
if (base != null) {
api.addParameter("base", base.get());
}
api.get(NativeMap.copyKeysIntoChildren("path", cb));
}
public static DiffApi diff(PatchSet.Id id, String path) {
return new DiffApi(ChangeApi.revision(id)
.view("files").id(path)

View File

@@ -129,11 +129,9 @@ class Header extends Composite {
@Override
protected void onLoad() {
ChangeApi.revision(patchSetId).view("files").get(
new GerritCallback<NativeMap<FileInfo>>() {
DiffApi.list(patchSetId, base, new GerritCallback<NativeMap<FileInfo>>() {
@Override
public void onSuccess(NativeMap<FileInfo> result) {
result.copyKeysIntoChildren("path");
JsArray<FileInfo> files = result.values();
FileInfo.sortFileInfoByPath(files);
int index = 0; // TODO: Maybe use patchIndex.