Add ChangeApi.get() method
Change-Id: I9862a2475781a37c6b964d2a977b3d187d44cf09
This commit is contained in:
@@ -53,7 +53,12 @@ import com.google.gerrit.common.data.LabelValue;
|
||||
import com.google.gerrit.common.data.Permission;
|
||||
import com.google.gerrit.common.data.PermissionRange;
|
||||
import com.google.gerrit.common.data.SubmitRecord;
|
||||
import com.google.gerrit.extensions.common.ActionInfo;
|
||||
import com.google.gerrit.extensions.common.CommitInfo;
|
||||
import com.google.gerrit.extensions.common.FetchInfo;
|
||||
import com.google.gerrit.extensions.common.GitPerson;
|
||||
import com.google.gerrit.extensions.common.ListChangesOption;
|
||||
import com.google.gerrit.extensions.common.RevisionInfo;
|
||||
import com.google.gerrit.extensions.config.DownloadCommand;
|
||||
import com.google.gerrit.extensions.config.DownloadScheme;
|
||||
import com.google.gerrit.extensions.registration.DynamicMap;
|
||||
@@ -75,7 +80,6 @@ import com.google.gerrit.server.AnonymousUser;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.account.AccountInfo;
|
||||
import com.google.gerrit.server.actions.ActionInfo;
|
||||
import com.google.gerrit.server.extensions.webui.UiActions;
|
||||
import com.google.gerrit.server.git.LabelNormalizer;
|
||||
import com.google.gerrit.server.patch.PatchListNotAvailableException;
|
||||
@@ -917,7 +921,7 @@ public class ChangeJson {
|
||||
DownloadCommand command = e2.getProvider().get();
|
||||
String c = command.getCommand(scheme, projectName, refName);
|
||||
if (c != null) {
|
||||
fetchInfo.addCommand(commandName, c);
|
||||
addCommand(fetchInfo, commandName, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -926,6 +930,13 @@ public class ChangeJson {
|
||||
return r;
|
||||
}
|
||||
|
||||
private void addCommand(FetchInfo fetchInfo, String commandName, String c) {
|
||||
if (fetchInfo.commands == null) {
|
||||
fetchInfo.commands = Maps.newTreeMap();
|
||||
}
|
||||
fetchInfo.commands.put(commandName, c);
|
||||
}
|
||||
|
||||
private static GitPerson toGitPerson(UserIdentity committer) {
|
||||
GitPerson p = new GitPerson();
|
||||
p.name = committer.getName();
|
||||
@@ -975,52 +986,6 @@ public class ChangeJson {
|
||||
}
|
||||
}
|
||||
|
||||
public static class RevisionInfo {
|
||||
private transient boolean isCurrent;
|
||||
public Boolean draft;
|
||||
public Boolean hasDraftComments;
|
||||
public int _number;
|
||||
public Map<String, FetchInfo> fetch;
|
||||
public CommitInfo commit;
|
||||
public Map<String, FileInfoJson.FileInfo> files;
|
||||
public Map<String, ActionInfo> actions;
|
||||
}
|
||||
|
||||
public static class FetchInfo {
|
||||
public String url;
|
||||
public String ref;
|
||||
public Map<String, String> commands;
|
||||
|
||||
FetchInfo(String url, String ref) {
|
||||
this.url = url;
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
void addCommand(String name, String command) {
|
||||
if (commands == null) {
|
||||
commands = Maps.newTreeMap();
|
||||
}
|
||||
commands.put(name, command);
|
||||
}
|
||||
}
|
||||
|
||||
public static class GitPerson {
|
||||
public String name;
|
||||
public String email;
|
||||
public Timestamp date;
|
||||
public int tz;
|
||||
}
|
||||
|
||||
public static class CommitInfo {
|
||||
public final String kind = "gerritcodereview#commit";
|
||||
public String commit;
|
||||
public List<CommitInfo> parents;
|
||||
public GitPerson author;
|
||||
public GitPerson committer;
|
||||
public String subject;
|
||||
public String message;
|
||||
}
|
||||
|
||||
public static class LabelInfo {
|
||||
transient SubmitRecord.Label.Status _status;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user