Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatasha Carson2018-11-28 20:31:05 -0500
committerNatasha Carson2019-02-21 18:42:44 -0500
commit688c1d99f908e26b1aa4f8c6adf9b3ced813796e (patch)
tree8fc3f5a45d8fc6b1a65260e3bb78f5ef1ff0fdee
parente7fe3fb66b2a6d12e4c070c6098be301b0843e63 (diff)
downloadorg.eclipse.mylyn.reviews-688c1d99f908e26b1aa4f8c6adf9b3ced813796e.tar.gz
org.eclipse.mylyn.reviews-688c1d99f908e26b1aa4f8c6adf9b3ced813796e.tar.xz
org.eclipse.mylyn.reviews-688c1d99f908e26b1aa4f8c6adf9b3ced813796e.zip
485981: retrieve patchset and project details via REST
working version of gerrit 2.12+ Change-Id: Ica863deeaa84a5dd3649f08f6150991a38371b5c Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=485981 Signed-off-by: Natasha Carson <natasha.carson@tasktop.com>
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritUtil.java12
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritClient.java32
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritClient212.java476
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/PatchSetContent.java10
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/compat/DownloadSchemeX.java20
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/compat/PatchScriptX.java117
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/AccessSectionInfo.java28
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/CommentInfo.java82
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/CommitInfo.java10
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/ConfigInfo.java100
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffContent.java77
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffFileMetaInfo.java46
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffInfo.java81
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffIntraLineInfo.java16
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffPreferencesInfo.java205
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/FileInfo.java52
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/FileInfos.java16
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/GitPersonalInfo.java16
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/GroupInfo.java139
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/GroupOptionsInfo.java18
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/InheritedBooleanInfo.java37
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/PermissionInfo.java47
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/PermissionRuleInfo.java56
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/ProjectAccessInfo.java129
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/RevisionInfo.java10
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/SubmitTypeInfo.java69
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/remote/PatchSetContentRemoteFactory.java45
-rw-r--r--org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/egit/EGitUiUtil.java36
-rw-r--r--org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/compare/ReviewItemSetCompareEditorInput.java10
-rw-r--r--org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/providers/ReviewsLabelProvider.java27
30 files changed, 1938 insertions, 81 deletions
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritUtil.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritUtil.java
index 828b5228..7c4ddcf2 100644
--- a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritUtil.java
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritUtil.java
@@ -94,8 +94,9 @@ public class GerritUtil {
if (supportsDownloadScheme(config, DownloadSchemeX.SSH)) {
return getSchemeUri(config, DownloadSchemeX.SSH, project);
+ } else if (config.getGerritConfig().getSchemes() != null) {
+ return null;
}
-
Set<DownloadScheme> supportedDownloadSchemes = config.getGerritConfig().getDownloadSchemes();
if (supportedDownloadSchemes.contains(DownloadScheme.SSH)
|| supportedDownloadSchemes.contains(DownloadScheme.DEFAULT_DOWNLOADS)) {
@@ -129,8 +130,9 @@ public class GerritUtil {
public static String getHttpCloneUri(TaskRepository repository, GerritConfiguration config, Project project) {
if (supportsDownloadScheme(config, DownloadSchemeX.HTTP)) {
return getSchemeUri(config, DownloadSchemeX.HTTP, project);
+ } else if (config.getGerritConfig().getSchemes() != null) {
+ return null;
}
-
Set<DownloadScheme> supportedDownloadSchemes = config.getGerritConfig().getDownloadSchemes();
if (supportedDownloadSchemes.contains(DownloadScheme.HTTP)
|| supportedDownloadSchemes.contains(DownloadScheme.DEFAULT_DOWNLOADS)) {
@@ -166,8 +168,9 @@ public class GerritUtil {
public static String getAnonHttpCloneUri(TaskRepository repository, GerritConfiguration config, Project project) {
if (supportsDownloadScheme(config, DownloadSchemeX.ANON_HTTP)) {
return getSchemeUri(config, DownloadSchemeX.ANON_HTTP, project);
+ } else if (config.getGerritConfig().getSchemes() != null) {
+ return null;
}
-
Set<DownloadScheme> supportedDownloadSchemes = config.getGerritConfig().getDownloadSchemes();
if (supportedDownloadSchemes.contains(DownloadScheme.ANON_HTTP)
|| supportedDownloadSchemes.contains(DownloadScheme.DEFAULT_DOWNLOADS)) {
@@ -193,8 +196,9 @@ public class GerritUtil {
public static String getAnonGitCloneUri(TaskRepository repository, GerritConfiguration config, Project project) {
if (supportsDownloadScheme(config, DownloadSchemeX.GIT)) {
return getSchemeUri(config, DownloadSchemeX.GIT, project);
+ } else if (config.getGerritConfig().getSchemes() != null) {
+ return null;
}
-
Set<DownloadScheme> supportedDownloadSchemes = config.getGerritConfig().getDownloadSchemes();
String gitAddress = config.getGerritConfig().getGitDaemonUrl();
if (gitAddress != null && (supportedDownloadSchemes.contains(DownloadScheme.ANON_GIT)
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritClient.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritClient.java
index cfb3c17f..ea42ad76 100644
--- a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritClient.java
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritClient.java
@@ -351,14 +351,7 @@ public abstract class GerritClient extends ReviewsClient {
throws GerritException {
List<Project> result = new ArrayList<Project>();
try {
- List<ProjectDetailX> projectDetails = restClient.execute(monitor,
- new Operation<List<ProjectDetailX>>(client) {
- @Override
- public void execute(IProgressMonitor monitor) throws GerritException {
- getProjectAdminService(monitor).visibleProjectDetails(this);
- }
- });
- for (ProjectDetailX projectDetail : projectDetails) {
+ for (ProjectDetailX projectDetail : getProjectDetails(monitor, gerritConfig, result)) {
if (!GerritUtil.isPermissionOnlyProject(projectDetail, gerritConfig)) {
result.add(projectDetail.project);
}
@@ -374,6 +367,17 @@ public abstract class GerritClient extends ReviewsClient {
return result;
}
+ protected List<ProjectDetailX> getProjectDetails(IProgressMonitor monitor, GerritConfig gerritConfig,
+ List<Project> result) throws GerritException {
+ List<ProjectDetailX> projectDetails = restClient.execute(monitor, new Operation<List<ProjectDetailX>>(client) {
+ @Override
+ public void execute(IProgressMonitor monitor) throws GerritException {
+ getProjectAdminService(monitor).visibleProjectDetails(this);
+ }
+ });
+ return projectDetails;
+ }
+
private boolean isNoSuchServiceError(GerritException e) {
String message = e.getMessage();
return message != null && message.contains("No such service method"); //$NON-NLS-1$
@@ -433,20 +437,18 @@ public abstract class GerritClient extends ReviewsClient {
}
}
- private PatchSetDetail getPatchSetDetail(final PatchSet.Id idBase, final PatchSet.Id idTarget,
- IProgressMonitor monitor) throws GerritException {
- PatchSetDetail patchSetDetail = null;
- patchSetDetail = restClient.execute(monitor, new Operation<PatchSetDetail>(client) {
+ protected PatchSetDetail getPatchSetDetail(PatchSet.Id idBase, PatchSet.Id idTarget, IProgressMonitor monitor)
+ throws GerritException {
+ PatchSetDetail patchSetDetail = restClient.execute(monitor, new Operation<PatchSetDetail>(client) {
@Override
public void execute(IProgressMonitor monitor) throws GerritException {
getChangeDetailService(monitor).patchSetDetail2(idBase, idTarget, createAccountDiffPreference(), this);
}
});
-
return patchSetDetail;
}
- private PatchScriptX getPatchScript(final Patch.Key key, final PatchSet.Id leftId, final PatchSet.Id rightId,
+ protected PatchScriptX getPatchScript(final Patch.Key key, final PatchSet.Id leftId, final PatchSet.Id rightId,
final IProgressMonitor monitor) throws GerritException {
final AccountDiffPreference diffPrefs = createAccountDiffPreference();
final PatchScriptX patchScript = restClient.execute(monitor, new Operation<PatchScriptX>(client) {
@@ -529,7 +531,7 @@ public abstract class GerritClient extends ReviewsClient {
}
}
- private AccountDiffPreference createAccountDiffPreference() {
+ protected AccountDiffPreference createAccountDiffPreference() {
AccountDiffPreference diffPrefs = new AccountDiffPreference((Account.Id) null);
diffPrefs.setLineLength(Integer.MAX_VALUE);
diffPrefs.setTabSize(4);
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritClient212.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritClient212.java
index 233a4592..6fc8b056 100644
--- a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritClient212.java
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritClient212.java
@@ -11,19 +11,67 @@
package org.eclipse.mylyn.internal.gerrit.core.client;
+import java.lang.reflect.Type;
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jgit.diff.Edit;
+import org.eclipse.mylyn.commons.core.StatusHandler;
+import org.eclipse.mylyn.internal.gerrit.core.GerritCorePlugin;
import org.eclipse.mylyn.internal.gerrit.core.client.compat.DownloadSchemeX;
import org.eclipse.mylyn.internal.gerrit.core.client.compat.GerritConfigX;
+import org.eclipse.mylyn.internal.gerrit.core.client.compat.PatchScriptX;
+import org.eclipse.mylyn.internal.gerrit.core.client.compat.ProjectDetailX;
import org.eclipse.mylyn.internal.gerrit.core.client.compat.SchemeInfo;
+import org.eclipse.mylyn.internal.gerrit.core.client.rest.AccountInfo;
+import org.eclipse.mylyn.internal.gerrit.core.client.rest.ChangeInfo;
+import org.eclipse.mylyn.internal.gerrit.core.client.rest.CommentInfo;
+import org.eclipse.mylyn.internal.gerrit.core.client.rest.CommitInfo;
+import org.eclipse.mylyn.internal.gerrit.core.client.rest.ConfigInfo;
+import org.eclipse.mylyn.internal.gerrit.core.client.rest.DiffContent;
+import org.eclipse.mylyn.internal.gerrit.core.client.rest.DiffInfo;
+import org.eclipse.mylyn.internal.gerrit.core.client.rest.DiffPreferencesInfo;
import org.eclipse.mylyn.internal.gerrit.core.client.rest.DownloadSchemeInfo;
+import org.eclipse.mylyn.internal.gerrit.core.client.rest.FileInfo;
+import org.eclipse.mylyn.internal.gerrit.core.client.rest.GitPersonalInfo;
+import org.eclipse.mylyn.internal.gerrit.core.client.rest.GroupInfo;
+import org.eclipse.mylyn.internal.gerrit.core.client.rest.ProjectAccessInfo;
+import org.eclipse.mylyn.internal.gerrit.core.client.rest.ProjectInfo;
import org.eclipse.mylyn.internal.gerrit.core.client.rest.ServerInfo;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.osgi.framework.Version;
+import com.google.gerrit.common.data.AccountInfoCache;
+import com.google.gerrit.common.data.CommentDetail;
+import com.google.gerrit.common.data.GerritConfig;
+import com.google.gerrit.common.data.PatchScript.DisplayMethod;
+import com.google.gerrit.common.data.PatchSetDetail;
+import com.google.gerrit.prettify.common.SparseFileContent;
+import com.google.gerrit.reviewdb.Account;
+import com.google.gerrit.reviewdb.AccountDiffPreference;
+import com.google.gerrit.reviewdb.AccountGroup;
+import com.google.gerrit.reviewdb.Change;
+import com.google.gerrit.reviewdb.Patch;
+import com.google.gerrit.reviewdb.Patch.ChangeType;
+import com.google.gerrit.reviewdb.Patch.Key;
+import com.google.gerrit.reviewdb.PatchLineComment;
+import com.google.gerrit.reviewdb.PatchSet;
+import com.google.gerrit.reviewdb.PatchSet.Id;
+import com.google.gerrit.reviewdb.PatchSetInfo;
+import com.google.gerrit.reviewdb.Project;
import com.google.gerrit.reviewdb.Project.NameKey;
+import com.google.gerrit.reviewdb.RevId;
+import com.google.gerrit.reviewdb.UserIdentity;
public class GerritClient212 extends GerritClient29 {
@@ -62,7 +110,435 @@ public class GerritClient212 extends GerritClient29 {
});
config.setSchemes(schemes);
+ config.setDownloadSchemes(
+ schemes.keySet().stream().map(scheme -> scheme.toDownloadScheme()).collect(Collectors.toSet()));
return config;
}
+
+ @Override
+ protected PatchSetDetail getPatchSetDetail(PatchSet.Id idBase, PatchSet.Id idTarget, IProgressMonitor monitor)
+ throws GerritException {
+ if (!GerritVersion.isVersion2120OrLater(getVersion())) {
+ return super.getPatchSetDetail(idBase, idTarget, monitor);
+ }
+ // Use REST API, RCP was removed in 2.13
+ PatchSetDetail patchSetDetail = new PatchSetDetail();
+ CommitInfo commitInfo = retrieveCommitInfo(idTarget, monitor);
+ AccountInfo accInfo = retrieveAccountInfo(commitInfo.getAuthor().getEmail(), monitor);
+ patchSetDetail.setInfo(adaptRestPatchSetInfo(commitInfo, accInfo, idTarget, monitor));
+ patchSetDetail.setPatchSet(adaptRestPatchSet(commitInfo, accInfo, idTarget, monitor));
+ patchSetDetail.setPatches(adaptRestPatches(idTarget, monitor));
+ return patchSetDetail;
+ }
+
+ @Override
+ protected PatchScriptX getPatchScript(final Patch.Key key, final PatchSet.Id leftId, final PatchSet.Id rightId,
+ final IProgressMonitor monitor) throws GerritException {
+ if (!GerritVersion.isVersion2120OrLater(getVersion())) {
+ return super.getPatchScript(key, leftId, rightId, monitor);
+ }
+
+ String fileName = key.getFileName();
+ AccountDiffPreference diffPrefs = adaptAccountDiffPref(
+ retrieveAccountInfo(retrieveCommitInfo(rightId, monitor).getAuthor().getEmail(), monitor),
+ retrieveDiffPrefInfo(retrieveCommitInfo(rightId, monitor).getAuthor().getEmail(), monitor));
+
+ DiffInfo diffInfo;
+ if (leftId == null) {
+ diffInfo = retrieveDiffInfoAgainstBase(rightId, fileName, monitor);
+ } else {
+ diffInfo = retrieveDiffInfoNotBase(rightId, leftId, fileName, monitor);
+ }
+
+ CommentDetail commentDetail;
+ if (diffInfo.getContent().get(0).getA() != null || diffInfo.getContent().get(0).getAb() != null
+ || diffInfo.getContent().get(0).getB() != null) {
+ commentDetail = setCommentDetails(leftId, rightId, fileName, monitor);
+ } else {
+ commentDetail = new CommentDetail(leftId, rightId);
+ }
+
+ PatchScriptX patchScriptX = new PatchScriptX();
+ patchScriptX.setChangeId(new Change.Key(rightId.getParentKey().toString()));
+ patchScriptX.setDiffPrefs(diffPrefs);
+ patchScriptX.setComments(commentDetail);
+ patchScriptX.setHeader(diffInfo.getDiff_header());
+ patchScriptX.setChangeType(diffInfo.getChange_type());
+ patchScriptX.setHistory(adaptRestPatches(rightId, monitor));
+ patchScriptX.setDisplayMethodA(DisplayMethod.DIFF); // hardcoded to diff.
+ patchScriptX.setDisplayMethodB(DisplayMethod.DIFF);
+
+ if (diffInfo.getContent() != null) {
+ patchScriptX.setEdits(adaptDiffContent(diffInfo, patchScriptX, monitor));
+ }
+
+ if (diffInfo.getMeta_a() != null) {
+ patchScriptX.setA(adaptSparseFileContent_A(diffInfo, monitor));
+ } else {
+ patchScriptX.setA(new SparseFileContent());
+ }
+ if (diffInfo.getMeta_b() != null) {
+ patchScriptX.setB(adaptSparseFileContent_B(diffInfo, monitor));
+ } else {
+ patchScriptX.setB(new SparseFileContent());
+ }
+
+ if (diffInfo.getDiff_header() != null) {
+ if (patchScriptX.isBinary()) {
+ fetchLeftBinaryContent(patchScriptX, key, leftId, monitor);
+ fetchRightBinaryContent(patchScriptX, key, rightId, monitor);
+ }
+ }
+ return patchScriptX;
+ }
+
+ private List<Patch> adaptRestPatches(Id id, IProgressMonitor monitor) throws GerritException {
+ List<Patch> patches = new ArrayList<>();
+ Map<String, FileInfo> infos = retrieveFileInfos(id, monitor);
+ for (String fileName : infos.keySet()) {
+ FileInfo fileInfo = infos.get(fileName);
+ Patch patch = new Patch(new Key(id, fileName));
+ patch.setChangeType(ChangeType.forCode(fileInfo.getStatus()));
+ patch.setDeletions(fileInfo.getLinesDeleted());
+ patch.setInsertions(fileInfo.getLinesInserted());
+ patches.add(patch);
+ }
+ return patches;
+ }
+
+ private PatchSet adaptRestPatchSet(CommitInfo commitInfo, AccountInfo accInfo, PatchSet.Id id,
+ IProgressMonitor monitor) throws GerritException {
+ PatchSet patchSet = new PatchSet(id);
+ patchSet.setRevision(new RevId(commitInfo.getCommit()));
+ patchSet.setUploader(new Account.Id(accInfo.getId()));
+ patchSet.setCreatedOn(parseTimeStamp(commitInfo.getAuthor().getDate()));
+ return patchSet;
+ }
+
+ private PatchSetInfo adaptRestPatchSetInfo(CommitInfo commitInfo, AccountInfo accInfo, PatchSet.Id id,
+ IProgressMonitor monitor) throws GerritException {
+ PatchSetInfo info = new PatchSetInfo(id);
+ info.setMessage(commitInfo.getMessage());
+ info.setSubject(commitInfo.getSubject());
+ info.setAuthor(toUserIdentity(commitInfo.getAuthor(), accInfo, monitor));
+ info.setCommitter(toUserIdentity(commitInfo.getCommitter(), accInfo, monitor));
+ return info;
+ }
+
+ private List<Edit> adaptDiffContent(DiffInfo diffInfo, PatchScriptX patchScriptX, IProgressMonitor monitor)
+ throws GerritException {
+ List<DiffContent> diffContent = diffInfo.getContent(); // content differences in file
+ List<Edit> editsInFile = new ArrayList<>();
+ int contentSize = 0;
+ for (DiffContent diff : diffContent) {
+ if (diff.getAb() != null) { // if ab, do nothing; this is not an Edit.
+ contentSize += diff.getAb().size();
+ } else if (diff.getA() != null && diff.getB() != null) {
+ Edit edit = new Edit(contentSize, contentSize + diff.getA().size() - 1, contentSize,
+ contentSize + diff.getB().size() - 1);
+ editsInFile.add(edit);
+ contentSize += diff.getA().size();
+ patchScriptX.setIntralineDifference(true); // this behavior might not be correct
+ } else if (diff.getA() != null) { // content only on side a (deleted in b)
+ Edit edit = new Edit(contentSize, contentSize + diff.getA().size() - 1, contentSize, contentSize);
+ editsInFile.add(edit);
+ contentSize += diff.getA().size();
+ } else if (diff.getB() != null) { // content only on side b (added in b)
+ Edit edit = new Edit(contentSize, contentSize, contentSize, contentSize + diff.getB().size() - 1);
+ editsInFile.add(edit);
+ contentSize += diff.getB().size();
+ }
+ }
+ return editsInFile;
+ }
+
+ private AccountDiffPreference adaptAccountDiffPref(AccountInfo accInfo, DiffPreferencesInfo diffPrefInfo) {
+ AccountDiffPreference accDiffPref = new AccountDiffPreference(new Account.Id(accInfo.getId()));
+ accDiffPref.setContext(diffPrefInfo.getContext());
+ accDiffPref.setIgnoreWhitespace(diffPrefInfo.getIgnoreWhitespace());
+ accDiffPref.setIntralineDifference(diffPrefInfo.isIntralineDifference());
+ accDiffPref.setLineLength(diffPrefInfo.getLineLength());
+ accDiffPref.setShowTabs(diffPrefInfo.isShowTabs());
+ accDiffPref.setShowWhitespaceErrors(diffPrefInfo.isShowWhitespaceErrors());
+ accDiffPref.setSyntaxHighlighting(diffPrefInfo.isSyntaxHighlighting());
+ accDiffPref.setTabSize(diffPrefInfo.getTabSize());
+ return accDiffPref;
+ }
+
+ private CommentDetail setCommentDetails(PatchSet.Id leftId, PatchSet.Id rightId, String fileName,
+ IProgressMonitor monitor) throws GerritException {
+ CommentDetail commentDetail = new CommentDetail(leftId, rightId);
+ if (leftId != null) {
+ Map<String, List<CommentInfo>> commentInfo_A = retrieveRevisionComments(leftId, monitor);
+ adaptCommentDetails(commentInfo_A, leftId, commentDetail.getCommentsA(), fileName, commentDetail);
+ }
+ Map<String, List<CommentInfo>> commentInfo_B = retrieveRevisionComments(rightId, monitor);
+ adaptCommentDetails(commentInfo_B, rightId, commentDetail.getCommentsB(), fileName, commentDetail);
+
+ ChangeInfo changeInfo = getChangeInfo(rightId.getParentKey().get(), monitor);
+ List<com.google.gerrit.common.data.AccountInfo> listAccountInfo = new ArrayList<com.google.gerrit.common.data.AccountInfo>();
+
+ com.google.gerrit.common.data.AccountInfo accountInfo = setAccountFromChangeInfo(changeInfo);
+ listAccountInfo.add(accountInfo);
+ AccountInfoCache accCache = new AccountInfoCache(listAccountInfo);
+ commentDetail.setAccountInfoCache(accCache);
+
+ return commentDetail;
+ }
+
+ private com.google.gerrit.common.data.AccountInfo setAccountFromChangeInfo(ChangeInfo changeInfo) {
+ com.google.gerrit.common.data.AccountInfo accountInfo;
+ Account account = new Account(new Account.Id(changeInfo.getOwner().getId()));
+ account.setFullName(changeInfo.getOwner().getName());
+ account.setUserName(changeInfo.getOwner().getUsername());
+ account.setPreferredEmail(changeInfo.getOwner().getEmail());
+ return new com.google.gerrit.common.data.AccountInfo(account);
+ }
+
+ private void adaptCommentDetails(Map<String, List<CommentInfo>> commentInfo, PatchSet.Id id,
+ List<PatchLineComment> side, String file, CommentDetail commentDetail) {
+ for (String filePath : commentInfo.keySet()) {
+ if (!filePath.equals(file)) {
+ continue;
+ }
+ List<CommentInfo> comments = commentInfo.get(filePath);
+ for (CommentInfo comment : comments) {
+ Patch.Key patchKey = new Patch.Key(id, filePath);
+ PatchLineComment.Key patchLineCommentKey = new PatchLineComment.Key(patchKey, comment.getId());
+ PatchLineComment lineComment = new PatchLineComment(patchLineCommentKey, comment.getLine(),
+ new Account.Id(comment.getAuthor().getId()), null);
+ populateLineComment(lineComment, comment);
+ side.add(lineComment);
+ }
+ }
+ }
+
+ private void populateLineComment(PatchLineComment lineComment, CommentInfo commentInfo) {
+ lineComment.setMessage(commentInfo.getMessage());
+ }
+
+ @Override
+ protected List<ProjectDetailX> getProjectDetails(IProgressMonitor monitor, GerritConfig gerritConfig,
+ List<Project> result) throws GerritException {
+ if (!GerritVersion.isVersion2120OrLater(getVersion())) {
+ return super.getProjectDetails(monitor, gerritConfig, result);
+ }
+
+ List<ProjectDetailX> projectDetails = adaptProjectDetails(gerritConfig, monitor);
+ return projectDetails;
+ }
+
+ private List<ProjectDetailX> adaptProjectDetails(GerritConfig gerritConfig, IProgressMonitor monitor)
+ throws GerritException {
+ ConfigInfo configInfo = retrieveProjectConfigs(gerritConfig.getWildProject().get(), monitor);
+ List<ProjectDetailX> projectDetails = new ArrayList<>();
+ Map<String, ProjectInfo> listedProjects = listProjects(monitor);
+ for (String projectName : listedProjects.keySet()) {
+ ProjectDetailX projectDetail = new ProjectDetailX();
+ projectDetail.setProject(adaptProject(configInfo, projectName, monitor));
+ projectDetail.setGroups(adaptGroups(projectName, monitor));
+ projectDetails.add(projectDetail);
+ }
+ return projectDetails;
+ }
+
+ private Project adaptProject(ConfigInfo configInfo, String projectName, IProgressMonitor monitor)
+ throws GerritException {
+ Project project = new Project(new Project.NameKey(projectName));
+ project.setDescription(configInfo.getDescription());
+ project.setUseContributorAgreements(configInfo.getUse_contributor_agreements().isValue());
+ project.setUseSignedOffBy(configInfo.getUse_signed_off_by().isValue());
+ project.setParent(new Project.NameKey(retrieveParentProject(projectName, monitor)));
+ return project;
+
+ }
+
+ private Map<AccountGroup.Id, AccountGroup> adaptGroups(String projectName, IProgressMonitor monitor)
+ throws GerritException {
+ Map<AccountGroup.Id, AccountGroup> groups = new HashMap<>();
+ ProjectAccessInfo accessRights = listAccessRights(projectName, monitor);
+ Map<String, GroupInfo> groupInfos = accessRights.getGroups();
+ if (groupInfos != null) {
+ for (String groupUuid : groupInfos.keySet()) {
+ GroupInfo groupInfo = groupInfos.get(groupUuid);
+ AccountGroup.Id groupId = AccountGroup.Id.parse(groupUuid);
+ String groupName = groupInfo.getName();
+ if (groupInfo.getName() == null) {
+ groupName = groupUuid;
+ }
+ groups.put(groupId, setAccountGroup(groupInfo, groupName, groupId));
+ }
+ }
+ return groups;
+ }
+
+ private AccountGroup setAccountGroup(GroupInfo groupInfo, String groupName, AccountGroup.Id groupId) {
+ AccountGroup.NameKey nameKey = new AccountGroup.NameKey(groupName);
+ AccountGroup accGroup = new AccountGroup(nameKey, groupId);
+ accGroup.setDescription(groupInfo.getDescription());
+ accGroup.setExternalNameKey(new AccountGroup.ExternalNameKey(groupName));
+ accGroup.setNameKey(nameKey);
+ accGroup.setOwnerGroupId(groupId);
+ accGroup.setType(getGroupType(groupInfo.getId()));
+ return accGroup;
+ }
+
+ private AccountGroup.Type getGroupType(String groupUuid) {
+ if (groupUuid.matches("^[0-9a-f]{40}$")) { //$NON-NLS-1$
+ return AccountGroup.Type.INTERNAL;
+ } else if (groupUuid.startsWith("global:")) { //$NON-NLS-1$
+ return AccountGroup.Type.SYSTEM;
+ } else if (groupUuid.startsWith("ldap:")) { //$NON-NLS-1$
+ return AccountGroup.Type.LDAP;
+ } else {
+ return null;
+ }
+ }
+
+ private SparseFileContent adaptSparseFileContent_A(DiffInfo diffInfo, IProgressMonitor monitor) {
+ SparseFileContent sparseFileContent = new SparseFileContent();
+ sparseFileContent.setSize(diffInfo.getMeta_a().getLines());
+ sparseFileContent.setPath(diffInfo.getMeta_a().getName());
+ sparseFileContent.setMissingNewlineAtEnd(false); // hardcoded, don't know how to get this from api
+ adaptLineContent_A(sparseFileContent, diffInfo);
+ return sparseFileContent;
+ }
+
+ private SparseFileContent adaptSparseFileContent_B(DiffInfo diffInfo, IProgressMonitor monitor) {
+ SparseFileContent sparseFileContent = new SparseFileContent();
+ sparseFileContent.setSize(diffInfo.getMeta_b().getLines());
+ sparseFileContent.setPath(diffInfo.getMeta_b().getName());
+ sparseFileContent.setMissingNewlineAtEnd(false); // hardcoded, don't know how to get this from api
+ adaptLineContent_B(sparseFileContent, diffInfo);
+ return sparseFileContent;
+ }
+
+ private void adaptLineContent_A(SparseFileContent sparseFileContent, DiffInfo diffInfo) {
+ List<DiffContent> diffContent = diffInfo.getContent();
+ int contentIdx = 0;
+ for (int i = 0; i < diffContent.size(); i++) {
+ if (diffContent.get(i).getAb() != null) { // add common content if this is the case
+ addLinesAndConvertToStrings(sparseFileContent, diffContent.get(i).getAb(), contentIdx);
+ contentIdx += diffContent.get(i).getAb().size();
+ } else if (diffContent.get(i).getA() != null) { // content only on side a (deleted in b)
+ addLinesAndConvertToStrings(sparseFileContent, diffContent.get(i).getA(), contentIdx);
+ contentIdx += diffContent.get(i).getA().size();
+ }
+ }
+ }
+
+ private void adaptLineContent_B(SparseFileContent sparseFileContent, DiffInfo diffInfo) {
+ List<DiffContent> diffContent = diffInfo.getContent();
+ int contentIdx = 0;
+ for (int i = 0; i < diffContent.size(); i++) {
+ if (diffContent.get(i).getAb() != null) { // add common content if this is the case
+ addLinesAndConvertToStrings(sparseFileContent, diffContent.get(i).getAb(), contentIdx);
+ contentIdx += diffContent.get(i).getAb().size();
+ } else if (diffContent.get(i).getB() != null) { // content only on side b (added in b)
+ addLinesAndConvertToStrings(sparseFileContent, diffContent.get(i).getB(), contentIdx);
+ contentIdx += diffContent.get(i).getB().size();
+ }
+ }
+ }
+
+ private void addLinesAndConvertToStrings(SparseFileContent sparseFileContent, ArrayList<String> ab, int idx) {
+ for (String string : ab) {
+ sparseFileContent.addLine(idx, string);
+ idx++;
+ }
+ }
+
+ private CommitInfo retrieveCommitInfo(PatchSet.Id id, IProgressMonitor monitor) throws GerritException {
+ String commitQuery = String.format("/changes/%s/revisions/%s/commit", id.getParentKey().get(), id.get()); //$NON-NLS-1$
+ return getRestClient().executeGetRestRequest(commitQuery, CommitInfo.class, monitor);
+ }
+
+ private Map<String, FileInfo> retrieveFileInfos(PatchSet.Id id, IProgressMonitor monitor) throws GerritException {
+ String commitQuery = String.format("/changes/%s/revisions/%s/files", id.getParentKey().get(), id.get()); //$NON-NLS-1$
+ @SuppressWarnings("serial")
+ Type mapTypeToken = new com.google.common.reflect.TypeToken<Map<String, FileInfo>>() {
+ }.getType();
+ return getRestClient().executeGetRestRequest(commitQuery, mapTypeToken, monitor);
+ }
+
+ private AccountInfo retrieveAccountInfo(String emailAsId, IProgressMonitor monitor) throws GerritException {
+ String accQuery = String.format("/accounts/%s", encode(emailAsId)); //$NON-NLS-1$
+ return getRestClient().executeGetRestRequest(accQuery, AccountInfo.class, monitor);
+ }
+
+ private DiffInfo retrieveDiffInfoNotBase(PatchSet.Id targetId, PatchSet.Id baseId, String fileName,
+ IProgressMonitor monitor) throws GerritException {
+ String query = String.format("/changes/%s/revisions/%s/files/%s/diff?base=%s", targetId.getParentKey().get(), //$NON-NLS-1$
+ targetId.get(), encode(fileName), baseId.get());
+ return getRestClient().executeGetRestRequest(query, DiffInfo.class, monitor);
+ }
+
+ private DiffInfo retrieveDiffInfoAgainstBase(PatchSet.Id targetId, String fileName, IProgressMonitor monitor)
+ throws GerritException {
+ String query = String.format("/changes/%s/revisions/%s/files/%s/diff", targetId.getParentKey().get(), //$NON-NLS-1$
+ targetId.get(), encode(fileName));
+ return getRestClient().executeGetRestRequest(query, DiffInfo.class, monitor);
+ }
+
+ private Map<String, List<CommentInfo>> retrieveRevisionComments(PatchSet.Id id, IProgressMonitor monitor)
+ throws GerritException {
+ String query = String.format("/changes/%s/revisions/%s/comments/", id.getParentKey().get(), id.get()); //$NON-NLS-1$
+ @SuppressWarnings("serial")
+ Type mapTypeToken = new com.google.common.reflect.TypeToken<Map<String, List<CommentInfo>>>() {
+ }.getType();
+ return getRestClient().executeGetRestRequest(query, mapTypeToken, monitor);
+ }
+
+ private ConfigInfo retrieveProjectConfigs(String projectName, IProgressMonitor monitor) throws GerritException {
+ String query = String.format("/projects/%s/config", encode(projectName)); //$NON-NLS-1$
+ return getRestClient().executeGetRestRequest(query, ConfigInfo.class, monitor);
+ }
+
+ private Map<String, ProjectInfo> listProjects(IProgressMonitor monitor) throws GerritException {
+ String query = String.format("/projects/?n=25"); //$NON-NLS-1$
+ @SuppressWarnings("serial")
+ Type mapTypeToken = new com.google.common.reflect.TypeToken<Map<String, ProjectInfo>>() {
+ }.getType();
+ return getRestClient().executeGetRestRequest(query, mapTypeToken, monitor);
+ }
+
+ private String retrieveParentProject(String projectName, IProgressMonitor monitor) throws GerritException {
+ String query = String.format("/projects/%s/parent", encode(projectName)); //$NON-NLS-1$
+ return getRestClient().executeGetRestRequest(query, String.class, monitor);
+ }
+
+ private ProjectAccessInfo listAccessRights(String projectName, IProgressMonitor monitor) throws GerritException {
+ String query = String.format("/projects/%s/access", encode(projectName)); //$NON-NLS-1$
+ return getRestClient().executeGetRestRequest(query, ProjectAccessInfo.class, monitor);
+ }
+
+ private DiffPreferencesInfo retrieveDiffPrefInfo(String emailAsId, IProgressMonitor monitor)
+ throws GerritException {
+ String query = String.format("/accounts/self/preferences.diff", encode(emailAsId)); //$NON-NLS-1$
+ return getRestClient().executeGetRestRequest(query, DiffPreferencesInfo.class, monitor);
+ }
+
+ private UserIdentity toUserIdentity(GitPersonalInfo info, AccountInfo accInfo, IProgressMonitor monitor)
+ throws GerritException {
+ UserIdentity userIdentity = new UserIdentity();
+ userIdentity.setAccount(new Account.Id(accInfo.getId()));
+ userIdentity.setEmail(info.getEmail());
+ userIdentity.setName(info.getName());
+ userIdentity.setTimeZone(info.getTimeZoneOffset());
+ userIdentity.setDate(parseTimeStamp(info.getDate()));
+
+ return userIdentity;
+ }
+
+ private Timestamp parseTimeStamp(String date) {
+ try {
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS"); //$NON-NLS-1$
+ Date parsedDate = dateFormat.parse(date);
+ return new java.sql.Timestamp(parsedDate.getTime());
+ } catch (ParseException e) {
+ StatusHandler.log(new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, e.getMessage(), e));
+ return null;
+ }
+ }
}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/PatchSetContent.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/PatchSetContent.java
index d535d53e..c66c362c 100644
--- a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/PatchSetContent.java
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/PatchSetContent.java
@@ -24,7 +24,7 @@ import com.google.gerrit.reviewdb.PatchSet;
* Defines a single patch set, that is a state comparison between an (optional) base and target. The content can then be
* populated by calling
* {@link GerritClient#loadPatchSetContent(GerritPatchSetContent, org.eclipse.core.runtime.IProgressMonitor)}.
- *
+ *
* @author Steffen Pingel
* @author Miles Parker
*/
@@ -40,7 +40,7 @@ public class PatchSetContent {
/**
* Creates empty patch set content using detailed target.
- *
+ *
* @param base
* may be null, in which case the target will be compared to an empty baseline
* @param targetDetail
@@ -53,7 +53,7 @@ public class PatchSetContent {
/**
* Creates empty patch set content using basic patch set.
- *
+ *
* @param base
* may be null, in which case the target will be compared to an empty baseline
* @param target
@@ -70,7 +70,7 @@ public class PatchSetContent {
public PatchSet getTarget() {
if (targetDetail != null) {
- return targetDetail.getPatchSet();
+ target = targetDetail.getPatchSet();
}
return target;
}
@@ -78,7 +78,7 @@ public class PatchSetContent {
/**
* Returns null if not supplied by constructor, unless initialized by
* {@link GerritClient#loadPatchSetContent(GerritPatchSetContent, org.eclipse.core.runtime.IProgressMonitor)}
- *
+ *
* @return
*/
public PatchSetDetail getTargetDetail() {
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/compat/DownloadSchemeX.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/compat/DownloadSchemeX.java
index 153ab508..abf873c5 100644
--- a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/compat/DownloadSchemeX.java
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/compat/DownloadSchemeX.java
@@ -11,25 +11,27 @@
package org.eclipse.mylyn.internal.gerrit.core.client.compat;
+import com.google.gerrit.reviewdb.AccountGeneralPreferences.DownloadScheme;
+
public enum DownloadSchemeX {
- ANON_HTTP("anonymous http"), HTTP("http"), GIT("git"), SSH("ssh"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- private String scheme;
+ ANON_HTTP(DownloadScheme.ANON_HTTP), HTTP(DownloadScheme.HTTP), GIT(DownloadScheme.ANON_GIT), SSH(
+ DownloadScheme.SSH);
+ private final DownloadScheme downloadScheme;
- private DownloadSchemeX(String scheme) {
- this.scheme = scheme;
+ private DownloadSchemeX(DownloadScheme scheme) {
+ this.downloadScheme = scheme;
}
- @Override
- public String toString() {
- return scheme;
+ public DownloadScheme toDownloadScheme() {
+ return downloadScheme;
}
public static DownloadSchemeX fromString(String scheme) {
for (DownloadSchemeX value : values()) {
- if (value.toString().equals(scheme)) {
+ if (value.toString().equalsIgnoreCase(scheme)) {
return value;
}
}
return null;
}
-}
+} \ No newline at end of file
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/compat/PatchScriptX.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/compat/PatchScriptX.java
index f28dafa2..ad213a7d 100644
--- a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/compat/PatchScriptX.java
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/compat/PatchScriptX.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Tasktop Technologies and others.
+S * Copyright (c) 2014 Tasktop Technologies and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,7 +11,17 @@
package org.eclipse.mylyn.internal.gerrit.core.client.compat;
+import java.util.List;
+
+import org.eclipse.jgit.diff.Edit;
+
+import com.google.gerrit.common.data.CommentDetail;
import com.google.gerrit.common.data.PatchScript;
+import com.google.gerrit.prettify.common.SparseFileContent;
+import com.google.gerrit.reviewdb.AccountDiffPreference;
+import com.google.gerrit.reviewdb.Change;
+import com.google.gerrit.reviewdb.Patch;
+import com.google.gerrit.reviewdb.Patch.ChangeType;
/**
* Provides support for binary content.
@@ -47,4 +57,109 @@ public class PatchScriptX extends PatchScript {
this.binaryB = binaryB;
}
+ public void setHeader(List<String> header) {
+ this.header = header;
+ }
+
+ public void setA(SparseFileContent contentA) {
+ this.a = contentA;
+ }
+
+ public void setB(SparseFileContent contentB) {
+ this.b = contentB;
+ }
+
+ public void setEdits(List<Edit> edits) {
+ this.edits = edits;
+ }
+
+ /**
+ * @param changeId
+ * the changeId to set
+ */
+ public void setChangeId(Change.Key changeId) {
+ this.changeId = changeId;
+ }
+
+ /**
+ * @param changeType
+ * the changeType to set
+ */
+ public void setChangeType(ChangeType changeType) {
+ this.changeType = changeType;
+ }
+
+ /**
+ * @param oldName
+ * the oldName to set
+ */
+ public void setOldName(String oldName) {
+ this.oldName = oldName;
+ }
+
+ /**
+ * @param newName
+ * the newName to set
+ */
+ public void setNewName(String newName) {
+ this.newName = newName;
+ }
+
+ /**
+ * @param diffPrefs
+ * the diffPrefs to set
+ */
+ @Override
+ public void setDiffPrefs(AccountDiffPreference diffPrefs) {
+ this.diffPrefs = diffPrefs;
+ }
+
+ /**
+ * @param displayMethodA
+ * the displayMethodA to set
+ */
+ public void setDisplayMethodA(DisplayMethod displayMethodA) {
+ this.displayMethodA = displayMethodA;
+ }
+
+ /**
+ * @param displayMethodB
+ * the displayMethodB to set
+ */
+ public void setDisplayMethodB(DisplayMethod displayMethodB) {
+ this.displayMethodB = displayMethodB;
+ }
+
+ /**
+ * @param comments
+ * the comments to set
+ */
+ public void setComments(CommentDetail comments) {
+ this.comments = comments;
+ }
+
+ /**
+ * @param history
+ * the history to set
+ */
+ public void setHistory(List<Patch> history) {
+ this.history = history;
+ }
+
+ /**
+ * @param hugeFile
+ * the hugeFile to set
+ */
+ public void setHugeFile(boolean hugeFile) {
+ this.hugeFile = hugeFile;
+ }
+
+ /**
+ * @param intralineDifference
+ * the intralineDifference to set
+ */
+ public void setIntralineDifference(boolean intralineDifference) {
+ this.intralineDifference = intralineDifference;
+ }
+
}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/AccessSectionInfo.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/AccessSectionInfo.java
new file mode 100644
index 00000000..54909011
--- /dev/null
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/AccessSectionInfo.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client.rest;
+
+import java.util.Map;
+
+public class AccessSectionInfo {
+
+ private Map<String, PermissionInfo> permissions;
+
+ public Map<String, PermissionInfo> getPermissions() {
+ return permissions;
+ }
+
+ public void setPermissions(Map<String, PermissionInfo> permissions) {
+ this.permissions = permissions;
+ }
+
+}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/CommentInfo.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/CommentInfo.java
new file mode 100644
index 00000000..6b8bff9e
--- /dev/null
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/CommentInfo.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client.rest;
+
+import java.sql.Timestamp;
+
+public class CommentInfo {
+
+ private String id;
+
+ private String path;
+
+ // REVISION (default) or PARENT
+// @SuppressWarnings("unused")
+ private String side;
+
+ // 0 for file comment (default)
+ private int line;
+
+ @SuppressWarnings("unused")
+ private String in_reply_to;
+
+ @SuppressWarnings("unused")
+ private Timestamp updated;
+
+ private String message;
+
+ private AccountInfo author;
+
+ public AccountInfo getAuthor() {
+ return author;
+ }
+
+ public void setAuthor(AccountInfo author) {
+ this.author = author;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public int getLine() {
+ return line;
+ }
+
+ public void setLine(int number) {
+ this.line = number;
+ }
+
+ public String getSide() {
+ return side;
+ }
+
+ public void setSide(String side) {
+ this.side = side;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/CommitInfo.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/CommitInfo.java
index 49efd2ba..11bd1803 100644
--- a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/CommitInfo.java
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/CommitInfo.java
@@ -12,8 +12,8 @@
package org.eclipse.mylyn.internal.gerrit.core.client.rest;
/**
- * Data model object for <a
- * href="https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#commit-info">CommitInfo</a>.
+ * Data model object for
+ * <a href="https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#commit-info">CommitInfo</a>.
*/
public class CommitInfo {
@@ -23,6 +23,8 @@ public class CommitInfo {
private GitPersonalInfo author;
+ private GitPersonalInfo committer;
+
private String subject;
private String message;
@@ -35,6 +37,10 @@ public class CommitInfo {
return author;
}
+ public GitPersonalInfo getCommitter() {
+ return committer;
+ }
+
public String getSubject() {
return subject;
}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/ConfigInfo.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/ConfigInfo.java
new file mode 100644
index 00000000..ec790416
--- /dev/null
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/ConfigInfo.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client.rest;
+
+public class ConfigInfo {
+
+ private String description;
+
+ private InheritedBooleanInfo use_contributor_agreements;
+
+ private InheritedBooleanInfo use_content_merge;
+
+ private InheritedBooleanInfo use_signed_off_by;
+
+ private SubmitTypeInfo default_submit_type;
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description
+ * the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @return the use_contributor_agreements
+ */
+ public InheritedBooleanInfo getUse_contributor_agreements() {
+ return use_contributor_agreements;
+ }
+
+ /**
+ * @param use_contributor_agreements
+ * the use_contributor_agreements to set
+ */
+ public void setUse_contributor_agreements(InheritedBooleanInfo use_contributor_agreements) {
+ this.use_contributor_agreements = use_contributor_agreements;
+ }
+
+ /**
+ * @return the use_content_merge
+ */
+ public InheritedBooleanInfo getUse_content_merge() {
+ return use_content_merge;
+ }
+
+ /**
+ * @param use_content_merge
+ * the use_content_merge to set
+ */
+ public void setUse_content_merge(InheritedBooleanInfo use_content_merge) {
+ this.use_content_merge = use_content_merge;
+ }
+
+ /**
+ * @return the use_signed_off_by
+ */
+ public InheritedBooleanInfo getUse_signed_off_by() {
+ return use_signed_off_by;
+ }
+
+ /**
+ * @param use_signed_off_by
+ * the use_signed_off_by to set
+ */
+ public void setUse_signed_off_by(InheritedBooleanInfo use_signed_off_by) {
+ this.use_signed_off_by = use_signed_off_by;
+ }
+
+ /**
+ * @return the default_submit_type
+ */
+ public SubmitTypeInfo getDefault_submit_type() {
+ return default_submit_type;
+ }
+
+ /**
+ * @param default_submit_type
+ * the default_submit_type to set
+ */
+ public void setDefault_submit_type(SubmitTypeInfo default_submit_type) {
+ this.default_submit_type = default_submit_type;
+ }
+}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffContent.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffContent.java
new file mode 100644
index 00000000..300d5fe6
--- /dev/null
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffContent.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client.rest;
+
+import java.util.ArrayList;
+
+public class DiffContent {
+
+ private ArrayList<String> a; // text that is deleted in B
+
+ private ArrayList<String> b; // text that is inserted in B
+
+ private ArrayList<String> ab; // text in the file on both sides (unchanged).
+
+ private DiffIntraLineInfo edit_A;
+
+ private DiffIntraLineInfo edit_B;
+
+ private boolean due_to_rebase;
+
+ public DiffIntraLineInfo getEdit_A() {
+ return edit_A;
+ }
+
+ public void setEdit_A(DiffIntraLineInfo edit_A) {
+ this.edit_A = edit_A;
+ }
+
+ public DiffIntraLineInfo getEdit_B() {
+ return edit_B;
+ }
+
+ public void setEdit_B(DiffIntraLineInfo edit_B) {
+ this.edit_B = edit_B;
+ }
+
+ public boolean isDue_to_rebase() {
+ return due_to_rebase;
+ }
+
+ public void setDue_to_rebase(boolean due_to_rebase) {
+ this.due_to_rebase = due_to_rebase;
+ }
+
+ public ArrayList<String> getA() {
+ return a;
+ }
+
+ public void setA(ArrayList<String> a) {
+ this.a = a;
+ }
+
+ public ArrayList<String> getB() {
+ return b;
+ }
+
+ public void setB(ArrayList<String> b) {
+ this.b = b;
+ }
+
+ public ArrayList<String> getAb() {
+ return ab;
+ }
+
+ public void setAb(ArrayList<String> ab) {
+ this.ab = ab;
+ }
+}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffFileMetaInfo.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffFileMetaInfo.java
new file mode 100644
index 00000000..0e629cae
--- /dev/null
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffFileMetaInfo.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client.rest;
+
+public class DiffFileMetaInfo {
+
+ private String name;
+
+ private String content_type;
+
+ private int lines;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getContent_type() {
+ return content_type;
+ }
+
+ public void setContent_type(String content_type) {
+ this.content_type = content_type;
+ }
+
+ public int getLines() {
+ return lines;
+ }
+
+ public void setLines(int lines) {
+ this.lines = lines;
+ }
+
+}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffInfo.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffInfo.java
new file mode 100644
index 00000000..72baaa85
--- /dev/null
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffInfo.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client.rest;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.gerrit.reviewdb.Patch.ChangeType;
+
+public class DiffInfo {
+
+ private DiffFileMetaInfo meta_a;
+
+ private DiffFileMetaInfo meta_b;
+
+ private ArrayList<DiffContent> content;
+
+ private ChangeType change_type;
+
+ private boolean intraline_status;
+
+ private List<String> diff_header;
+
+ public DiffFileMetaInfo getMeta_a() {
+ return meta_a;
+ }
+
+ public void setMeta_a(DiffFileMetaInfo meta_a) {
+ this.meta_a = meta_a;
+ }
+
+ public DiffFileMetaInfo getMeta_b() {
+ return meta_b;
+ }
+
+ public void setMeta_b(DiffFileMetaInfo meta_b) {
+ this.meta_b = meta_b;
+ }
+
+ public boolean isIntraline_status() {
+ return intraline_status;
+ }
+
+ public void setIntraline_status(boolean intraline_status) {
+ this.intraline_status = intraline_status;
+ }
+
+ public List<String> getDiff_header() {
+ return diff_header;
+ }
+
+ public void setDiff_header(List<String> diff_header) {
+ this.diff_header = diff_header;
+ }
+
+ public ChangeType getChange_type() {
+ return change_type;
+ }
+
+ public void setChange_type(ChangeType change_type) {
+ this.change_type = change_type;
+ }
+
+ public ArrayList<DiffContent> getContent() {
+ return content;
+ }
+
+ public void setContent(ArrayList<DiffContent> content) {
+ this.content = content;
+ }
+
+}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffIntraLineInfo.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffIntraLineInfo.java
new file mode 100644
index 00000000..78b8d984
--- /dev/null
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffIntraLineInfo.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client.rest;
+
+public class DiffIntraLineInfo {
+
+}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffPreferencesInfo.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffPreferencesInfo.java
new file mode 100644
index 00000000..1ff9a54a
--- /dev/null
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/DiffPreferencesInfo.java
@@ -0,0 +1,205 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client.rest;
+
+import com.google.gerrit.reviewdb.AccountDiffPreference.Whitespace;
+
+public class DiffPreferencesInfo {
+
+ private Whitespace ignore_whitespace;
+
+ private int tab_size;
+
+ private int line_Length;
+
+ private boolean syntax_highlighting;
+
+ private boolean show_whitespace_errors;
+
+ private boolean intraline_difference;
+
+ private boolean show_tabs;
+
+ private boolean expand_all_comments;
+
+ private short context;
+
+ private String theme;
+
+ /**
+ * @return the theme
+ */
+ public String getTheme() {
+ return theme;
+ }
+
+ /**
+ * @param theme
+ * the theme to set
+ */
+ public void setTheme(String theme) {
+ this.theme = theme;
+ }
+
+ /**
+ * @return the cursor_blink_rate
+ */
+ public int getCursor_blink_rate() {
+ return cursor_blink_rate;
+ }
+
+ /**
+ * @param cursor_blink_rate
+ * the cursor_blink_rate to set
+ */
+ public void setCursor_blink_rate(int cursor_blink_rate) {
+ this.cursor_blink_rate = cursor_blink_rate;
+ }
+
+ private int cursor_blink_rate;
+
+ /**
+ * @return the ignoreWhitespace
+ */
+ public Whitespace getIgnoreWhitespace() {
+ return ignore_whitespace;
+ }
+
+ /**
+ * @param ignoreWhitespace
+ * the ignoreWhitespace to set
+ */
+ public void setIgnoreWhitespace(Whitespace ignoreWhitespace) {
+ this.ignore_whitespace = ignoreWhitespace;
+ }
+
+ /**
+ * @return the tabSize
+ */
+ public int getTabSize() {
+ return tab_size;
+ }
+
+ /**
+ * @param tabSize
+ * the tabSize to set
+ */
+ public void setTabSize(int tabSize) {
+ this.tab_size = tabSize;
+ }
+
+ /**
+ * @return the lineLength
+ */
+ public int getLineLength() {
+ return line_Length;
+ }
+
+ /**
+ * @param lineLength
+ * the lineLength to set
+ */
+ public void setLineLength(int lineLength) {
+ this.line_Length = lineLength;
+ }
+
+ /**
+ * @return the syntaxHighlighting
+ */
+ public boolean isSyntaxHighlighting() {
+ return syntax_highlighting;
+ }
+
+ /**
+ * @param syntaxHighlighting
+ * the syntaxHighlighting to set
+ */
+ public void setSyntaxHighlighting(boolean syntaxHighlighting) {
+ this.syntax_highlighting = syntaxHighlighting;
+ }
+
+ /**
+ * @return the showWhitespaceErrors
+ */
+ public boolean isShowWhitespaceErrors() {
+ return show_whitespace_errors;
+ }
+
+ /**
+ * @param showWhitespaceErrors
+ * the showWhitespaceErrors to set
+ */
+ public void setShowWhitespaceErrors(boolean showWhitespaceErrors) {
+ this.show_whitespace_errors = showWhitespaceErrors;
+ }
+
+ /**
+ * @return the intralineDifference
+ */
+ public boolean isIntralineDifference() {
+ return intraline_difference;
+ }
+
+ /**
+ * @param intralineDifference
+ * the intralineDifference to set
+ */
+ public void setIntralineDifference(boolean intralineDifference) {
+ this.intraline_difference = intralineDifference;
+ }
+
+ /**
+ * @return the showTabs
+ */
+ public boolean isShowTabs() {
+ return show_tabs;
+ }
+
+ /**
+ * @param showTabs
+ * the showTabs to set
+ */
+ public void setShowTabs(boolean showTabs) {
+ this.show_tabs = showTabs;
+ }
+
+ /**
+ * @return the expand_all_comments
+ */
+ public boolean isExpand_all_comments() {
+ return expand_all_comments;
+ }
+
+ /**
+ * @param expand_all_comments
+ * the expand_all_comments to set
+ */
+ public void setExpand_all_comments(boolean expand_all_comments) {
+ this.expand_all_comments = expand_all_comments;
+ }
+
+ /**
+ * @return the context
+ */
+ public short getContext() {
+ return context;
+ }
+
+ /**
+ * @param context
+ * the context to set
+ */
+ public void setContext(short context) {
+ this.context = context;
+ }
+
+}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/FileInfo.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/FileInfo.java
new file mode 100644
index 00000000..4a832ca2
--- /dev/null
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/FileInfo.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client.rest;
+
+public class FileInfo {
+
+ private char status;
+
+ private int linesInserted;
+
+ private int linesDeleted;
+
+ private int sizeDelta;
+
+ private int size;
+
+ private boolean binary;
+
+ public char getStatus() {
+ return status == '\0' ? 'M' : status;
+ }
+
+ public int getLinesInserted() {
+ return linesInserted;
+ }
+
+ public int getLinesDeleted() {
+ return linesDeleted;
+ }
+
+ public int getSizeDelta() {
+ return sizeDelta;
+ }
+
+ public int getSize() {
+ return size;
+ }
+
+ public boolean isBinary() {
+ return binary;
+ }
+
+}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/FileInfos.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/FileInfos.java
new file mode 100644
index 00000000..d6735520
--- /dev/null
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/FileInfos.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client.rest;
+
+public class FileInfos {
+
+}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/GitPersonalInfo.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/GitPersonalInfo.java
index 237c04e4..d6d51af7 100644
--- a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/GitPersonalInfo.java
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/GitPersonalInfo.java
@@ -12,8 +12,8 @@
package org.eclipse.mylyn.internal.gerrit.core.client.rest;
/**
- * Data model object for <a
- * href="https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#git-personal-info"
+ * Data model object for
+ * <a href="https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#git-personal-info"
* >GitPersonalInfo</a>.
*/
public class GitPersonalInfo {
@@ -22,6 +22,10 @@ public class GitPersonalInfo {
private String email;
+ private int tz;
+
+ private String date;
+
public String getName() {
return name;
}
@@ -30,4 +34,12 @@ public class GitPersonalInfo {
return email;
}
+ public int getTimeZoneOffset() {
+ return tz;
+ }
+
+ public String getDate() {
+ return date;
+ }
+
}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/GroupInfo.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/GroupInfo.java
new file mode 100644
index 00000000..0100b4b5
--- /dev/null
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/GroupInfo.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client.rest;
+
+import java.sql.Timestamp;
+import java.util.List;
+
+public class GroupInfo {
+
+ private String id;
+
+ private String name;
+
+ private String description;
+
+ private String url;
+
+ private int group_id;
+
+ private String owner;
+
+ private String owner_id;
+
+ private Timestamp created_on;
+
+ private GroupOptionsInfo options;
+
+ private boolean _more_groups;
+
+ private List<AccountInfo> members;
+
+ private List<GroupInfo> includes;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public int getGroup_id() {
+ return group_id;
+ }
+
+ public void setGroup_id(int group_id) {
+ this.group_id = group_id;
+ }
+
+ public String getOwner() {
+ return owner;
+ }
+
+ public void setOwner(String owner) {
+ this.owner = owner;
+ }
+
+ public String getOwner_id() {
+ return owner_id;
+ }
+
+ public void setOwner_id(String owner_id) {
+ this.owner_id = owner_id;
+ }
+
+ public Timestamp getCreated_on() {
+ return created_on;
+ }
+
+ public void setCreated_on(Timestamp created_on) {
+ this.created_on = created_on;
+ }
+
+ public GroupOptionsInfo getOptions() {
+ return options;
+ }
+
+ public void setOptions(GroupOptionsInfo options) {
+ this.options = options;
+ }
+
+ public boolean is_more_groups() {
+ return _more_groups;
+ }
+
+ public void set_more_groups(boolean _more_groups) {
+ this._more_groups = _more_groups;
+ }
+
+ public List<AccountInfo> getMembers() {
+ return members;
+ }
+
+ public void setMembers(List<AccountInfo> members) {
+ this.members = members;
+ }
+
+ public List<GroupInfo> getIncludes() {
+ return includes;
+ }
+
+ public void setIncludes(List<GroupInfo> includes) {
+ this.includes = includes;
+ }
+
+}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/GroupOptionsInfo.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/GroupOptionsInfo.java
new file mode 100644
index 00000000..c0efefc9
--- /dev/null
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/GroupOptionsInfo.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client.rest;
+
+public class GroupOptionsInfo {
+
+ boolean visible_to_all;
+
+}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/InheritedBooleanInfo.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/InheritedBooleanInfo.java
new file mode 100644
index 00000000..bfa727ae
--- /dev/null
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/InheritedBooleanInfo.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client.rest;
+
+public class InheritedBooleanInfo {
+
+ private boolean value;
+
+ private boolean configured_value;
+
+ private boolean inherited_value;
+
+ /**
+ * @return the value
+ */
+ public boolean isValue() {
+ return value;
+ }
+
+ /**
+ * @param value
+ * the value to set
+ */
+ public void setValue(boolean value) {
+ this.value = value;
+ }
+
+}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/PermissionInfo.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/PermissionInfo.java
new file mode 100644
index 00000000..28a8fc1a
--- /dev/null
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/PermissionInfo.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client.rest;
+
+import java.util.Map;
+
+public class PermissionInfo {
+
+ private String label;
+
+ private boolean exclusive;
+
+ private Map<String, PermissionRuleInfo> rules;
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public boolean isExclusive() {
+ return exclusive;
+ }
+
+ public void setExclusive(boolean exclusive) {
+ this.exclusive = exclusive;
+ }
+
+ public Map<String, PermissionRuleInfo> getRules() {
+ return rules;
+ }
+
+ public void setRules(Map<String, PermissionRuleInfo> rules) {
+ this.rules = rules;
+ }
+}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/PermissionRuleInfo.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/PermissionRuleInfo.java
new file mode 100644
index 00000000..889894bf
--- /dev/null
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/PermissionRuleInfo.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client.rest;
+
+public class PermissionRuleInfo {
+
+ private String action;
+
+ private boolean force;
+
+ private int min;
+
+ private int max;
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public boolean isForce() {
+ return force;
+ }
+
+ public void setForce(boolean force) {
+ this.force = force;
+ }
+
+ public int getMin() {
+ return min;
+ }
+
+ public void setMin(int min) {
+ this.min = min;
+ }
+
+ public int getMax() {
+ return max;
+ }
+
+ public void setMax(int max) {
+ this.max = max;
+ }
+
+}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/ProjectAccessInfo.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/ProjectAccessInfo.java
new file mode 100644
index 00000000..80d34251
--- /dev/null
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/ProjectAccessInfo.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client.rest;
+
+import java.util.List;
+import java.util.Map;
+
+public class ProjectAccessInfo {
+
+ private String revision;
+
+ private ProjectInfo inherits_from;
+
+ private Map<String, AccessSectionInfo> local;
+
+ private boolean is_owner;
+
+ private boolean can_upload;
+
+ private boolean can_add;
+
+ private boolean can_add_tags;
+
+ private boolean config_visible;
+
+ private Map<String, GroupInfo> groups;
+
+ private List<String> owner_of;
+
+ private List<String> configWebLinks;
+
+ public String getRevision() {
+ return revision;
+ }
+
+ public void setRevision(String revision) {
+ this.revision = revision;
+ }
+
+ public ProjectInfo getInherits_from() {
+ return inherits_from;
+ }
+
+ public void setInherits_from(ProjectInfo inherits_from) {
+ this.inherits_from = inherits_from;
+ }
+
+ public Map<String, AccessSectionInfo> getLocal() {
+ return local;
+ }
+
+ public void setLocal(Map<String, AccessSectionInfo> local) {
+ this.local = local;
+ }
+
+ public boolean isIs_owner() {
+ return is_owner;
+ }
+
+ public void setIs_owner(boolean is_owner) {
+ this.is_owner = is_owner;
+ }
+
+ public boolean isCan_upload() {
+ return can_upload;
+ }
+
+ public void setCan_upload(boolean can_upload) {
+ this.can_upload = can_upload;
+ }
+
+ public boolean isCan_add() {
+ return can_add;
+ }
+
+ public void setCan_add(boolean can_add) {
+ this.can_add = can_add;
+ }
+
+ public boolean isCan_add_tags() {
+ return can_add_tags;
+ }
+
+ public void setCan_add_tags(boolean can_add_tags) {
+ this.can_add_tags = can_add_tags;
+ }
+
+ public boolean isConfig_visible() {
+ return config_visible;
+ }
+
+ public void setConfig_visible(boolean config_visible) {
+ this.config_visible = config_visible;
+ }
+
+ public Map<String, GroupInfo> getGroups() {
+ return groups;
+ }
+
+ public void setGroups(Map<String, GroupInfo> groups) {
+ this.groups = groups;
+ }
+
+ public List<String> getOwner_of() {
+ return owner_of;
+ }
+
+ public void setOwner_of(List<String> owner_of) {
+ this.owner_of = owner_of;
+ }
+
+ public List<String> getConfigWebLinks() {
+ return configWebLinks;
+ }
+
+ public void setConfigWebLinks(List<String> configWebLinks) {
+ this.configWebLinks = configWebLinks;
+ }
+
+}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/RevisionInfo.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/RevisionInfo.java
index 781dcaf0..a8b87c01 100644
--- a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/RevisionInfo.java
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/RevisionInfo.java
@@ -14,8 +14,8 @@ package org.eclipse.mylyn.internal.gerrit.core.client.rest;
import java.util.Map;
/**
- * Data model object for <a
- * href="https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-info">RevisionInfo</a>.
+ * Data model object for
+ * <a href="https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-info">RevisionInfo</a>.
*/
public class RevisionInfo {
@@ -27,6 +27,8 @@ public class RevisionInfo {
private CommitInfo commit;
+ private AccountInfo uploader;
+
public boolean isDraft() {
return draft;
}
@@ -42,4 +44,8 @@ public class RevisionInfo {
public CommitInfo getCommit() {
return commit;
}
+
+ public AccountInfo getUploader() {
+ return uploader;
+ }
}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/SubmitTypeInfo.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/SubmitTypeInfo.java
new file mode 100644
index 00000000..07432dbc
--- /dev/null
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/rest/SubmitTypeInfo.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client.rest;
+
+import com.google.gerrit.reviewdb.Project.SubmitType;
+
+public class SubmitTypeInfo {
+
+ private SubmitType value;
+
+ private SubmitType configured_value;
+
+ private SubmitType inherited_value;
+
+ /**
+ * @return the value
+ */
+ public SubmitType getValue() {
+ return value;
+ }
+
+ /**
+ * @param value
+ * the value to set
+ */
+ public void setValue(SubmitType value) {
+ this.value = value;
+ }
+
+ /**
+ * @return the configured_value
+ */
+ public SubmitType getConfigured_value() {
+ return configured_value;
+ }
+
+ /**
+ * @param configured_value
+ * the configured_value to set
+ */
+ public void setConfigured_value(SubmitType configured_value) {
+ this.configured_value = configured_value;
+ }
+
+ /**
+ * @return the inherited_value
+ */
+ public SubmitType getInherited_value() {
+ return inherited_value;
+ }
+
+ /**
+ * @param inherited_value
+ * the inherited_value to set
+ */
+ public void setInherited_value(SubmitType inherited_value) {
+ this.inherited_value = inherited_value;
+ }
+
+}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/remote/PatchSetContentRemoteFactory.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/remote/PatchSetContentRemoteFactory.java
index 41832598..a257181b 100644
--- a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/remote/PatchSetContentRemoteFactory.java
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/remote/PatchSetContentRemoteFactory.java
@@ -45,12 +45,12 @@ import com.google.gerrit.reviewdb.PatchLineComment;
/**
* Manages retrieval of patch set contents, including file versions and associated comments, from Gerrit API.
- *
+ *
* @author Miles Parker
* @author Steffen Pingel
*/
-public abstract class PatchSetContentRemoteFactory<RemoteKeyType> extends
- ReviewItemSetContentRemoteFactory<PatchSetContent, RemoteKeyType> {
+public abstract class PatchSetContentRemoteFactory<RemoteKeyType>
+ extends ReviewItemSetContentRemoteFactory<PatchSetContent, RemoteKeyType> {
private final ReviewItemCache cache;
@@ -82,8 +82,8 @@ public abstract class PatchSetContentRemoteFactory<RemoteKeyType> extends
comments.addAll(commentDetail.getCommentsA());
comments.addAll(commentDetail.getCommentsB());
for (PatchLineComment comment : comments) {
- gerritFactoryProvider.pullUser(gerritFactoryProvider.getRoot(), patchScript.getCommentDetail()
- .getAccounts(), comment.getAuthor(), monitor);
+ gerritFactoryProvider.pullUser(gerritFactoryProvider.getRoot(),
+ patchScript.getCommentDetail().getAccounts(), comment.getAuthor(), monitor);
}
}
return content;
@@ -166,18 +166,21 @@ public abstract class PatchSetContentRemoteFactory<RemoteKeyType> extends
if (baseVersion == null) {
baseVersion = IReviewsFactory.INSTANCE.createFileVersion();
baseVersion.setId(baseId);
- if (patchScript.isBinary()) {
- baseVersion.setBinaryContent(patchScript.getBinaryA());
- } else {
- baseVersion.setContent(patchScript.getA().asString());
+ if (patchScript.getPatchHeader() != null) {
+ if (patchScript.isBinary()) {
+ baseVersion.setBinaryContent(patchScript.getBinaryA());
+ } else {
+ baseVersion.setContent(patchScript.getA().asString());
+ }
+ baseVersion.setPath(patchScript.getA().getPath());
+ baseVersion.setDescription((content.getBase() != null)
+ ? NLS.bind(Messages.PatchSetContentRemoteFactory_Patch_Set,
+ content.getBase().getPatchSetId())
+ : Messages.PatchSetContentRemoteFactory_Base);
+ baseVersion.setFile(item);
+ baseVersion.setName(item.getName());
+ getCache().put(baseVersion);
}
- baseVersion.setPath(patchScript.getA().getPath());
- baseVersion.setDescription((content.getBase() != null)
- ? NLS.bind(Messages.PatchSetContentRemoteFactory_Patch_Set, content.getBase()
- .getPatchSetId()) : Messages.PatchSetContentRemoteFactory_Base);
- baseVersion.setFile(item);
- baseVersion.setName(item.getName());
- getCache().put(baseVersion);
}
item.setBase(baseVersion);
@@ -186,10 +189,12 @@ public abstract class PatchSetContentRemoteFactory<RemoteKeyType> extends
targetVersion = IReviewsFactory.INSTANCE.createFileVersion();
targetVersion.setId(targetId);
SparseFileContent target = patchScript.getB().apply(patchScript.getA(), patchScript.getEdits());
- if (patchScript.isBinary()) {
- targetVersion.setBinaryContent(patchScript.getBinaryB());
- } else {
- targetVersion.setContent(target.asString());
+ if (patchScript.getPatchHeader() != null) {
+ if (patchScript.isBinary()) {
+ targetVersion.setBinaryContent(patchScript.getBinaryB());
+ } else {
+ targetVersion.setContent(target.asString());
+ }
}
targetVersion.setPath(patchScript.getB().getPath());
targetVersion.setDescription(NLS.bind(Messages.PatchSetContentRemoteFactory_Patch_Set,
diff --git a/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/egit/EGitUiUtil.java b/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/egit/EGitUiUtil.java
index 51f19c9c..1d7f25ee 100644
--- a/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/egit/EGitUiUtil.java
+++ b/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/egit/EGitUiUtil.java
@@ -16,6 +16,7 @@ import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -42,9 +43,11 @@ import org.eclipse.jgit.transport.RemoteConfig;
import org.eclipse.mylyn.internal.gerrit.core.GerritCorePlugin;
import org.eclipse.mylyn.internal.gerrit.core.GerritUtil;
import org.eclipse.mylyn.internal.gerrit.core.client.GerritConfiguration;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritException;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.swt.widgets.Shell;
+import com.google.gerrit.reviewdb.AccountGeneralPreferences.DownloadScheme;
import com.google.gerrit.reviewdb.PatchSet;
import com.google.gerrit.reviewdb.Project;
@@ -97,12 +100,13 @@ public class EGitUiUtil {
public GitRepositoryInfo getGitRepositoryInfo() throws NoRepositoryInfoException {
GitRepositoryInfo gitRepositoryInfo;
try {
- GerritConfiguration config = GerritCorePlugin.getGerritClient(repository).getConfiguration();
- gitRepositoryInfo = new GitRepositoryInfo(GerritUtil.getSshCloneUri(repository, config, project));
- } catch (URISyntaxException e) {
- throw new NoRepositoryInfoException(e.getMessage(), e);
+ GerritConfiguration config = GerritCorePlugin.getGerritClient(repository).refreshConfig(null);
+ gitRepositoryInfo = new GitRepositoryInfo(getCloneUriForRepo(repository, config, project));
+ return gitRepositoryInfo;
+ } catch (GerritException e) {
+
}
- return gitRepositoryInfo;
+ return null;
}
});
WizardDialog dlg = new WizardDialog(shell, cloneWizard);
@@ -110,4 +114,26 @@ public class EGitUiUtil {
return dlg.open();
}
+ private static String getCloneUriForRepo(TaskRepository repository, GerritConfiguration config, Project project)
+ throws NoRepositoryInfoException {
+ try {
+ Map<DownloadScheme, String> cloneUris = GerritUtil.getCloneUris(config, repository, project);
+ if (cloneUris.keySet().contains(DownloadScheme.SSH)) {
+ return cloneUris.get(DownloadScheme.SSH);
+ }
+ if (cloneUris.keySet().contains(DownloadScheme.HTTP)) {
+ return cloneUris.get(DownloadScheme.HTTP);
+ }
+ for (DownloadScheme scheme : cloneUris.keySet()) {
+ if (cloneUris.get(scheme) != null) {
+ return cloneUris.get(scheme);
+ }
+ }
+ return null;
+ } catch (URISyntaxException e) {
+ throw new NoRepositoryInfoException(e.getMessage(), e);
+ }
+
+ }
+
}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/compare/ReviewItemSetCompareEditorInput.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/compare/ReviewItemSetCompareEditorInput.java
index 9bbf6d12..c039c4a2 100644
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/compare/ReviewItemSetCompareEditorInput.java
+++ b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/compare/ReviewItemSetCompareEditorInput.java
@@ -60,11 +60,13 @@ public class ReviewItemSetCompareEditorInput extends ReviewItemCompareEditorInpu
if (!(item instanceof IFileItem)) {
continue;
}
+ IFileItem fileItem = (IFileItem) item;
+ if (fileItem.getBase().getContent() != null) {
+ FileItemNode node = new FileItemNode(behavior, fileItem, monitor);
- FileItemNode node = new FileItemNode(behavior, (IFileItem) item, monitor);
-
- DiffNode parent = findNode(root, node.getPath());
- parent.add(node);
+ DiffNode parent = findNode(root, node.getPath());
+ parent.add(node);
+ }
}
for (IDiffElement child : root.getChildren()) {
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/providers/ReviewsLabelProvider.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/providers/ReviewsLabelProvider.java
index 065ea40b..15d87364 100644
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/providers/ReviewsLabelProvider.java
+++ b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/providers/ReviewsLabelProvider.java
@@ -270,18 +270,21 @@ public abstract class ReviewsLabelProvider extends TableStyledLabelProvider {
IFileItem fileItem = (IFileItem) element;
IFileVersion base = fileItem.getBase();
IFileVersion target = fileItem.getTarget();
- if (target.getPath() != null && base.getPath() == null) {
- return NLS.bind(Messages.ReviewsLabelProvider_X_Revision_Y, target.getPath(),
- target.getDescription());
- } else if (target.getPath() == null && base.getPath() != null) {
- return NLS.bind(Messages.ReviewsLabelProvider_X_Revision_Y, base.getPath(),
- target.getDescription());
- } else if (!target.getPath().equals(base.getPath())) {
- return NLS.bind(Messages.ReviewsLabelProvider_X_renamed_from_Y_Z,
- new Object[] { target.getPath(), base.getPath(), target.getDescription() });
- } else {
- return NLS.bind(Messages.ReviewsLabelProvider_X_Revision_Y, target.getPath(),
- target.getDescription());
+ if (target != null) {
+ if (target.getPath() != null && base.getPath() == null) {
+ return NLS.bind(Messages.ReviewsLabelProvider_X_Revision_Y, target.getPath(),
+ target.getDescription());
+ } else if (target.getPath() == null && base.getPath() != null) {
+ return NLS.bind(Messages.ReviewsLabelProvider_X_Revision_Y, base.getPath(),
+ target.getDescription());
+ } else if (target.getPath() != null && !target.getPath().equals(base.getPath())) {
+ return NLS.bind(Messages.ReviewsLabelProvider_X_renamed_from_Y_Z,
+ new Object[] { target.getPath(), base.getPath(), target.getDescription() });
+ } else {
+ return NLS.bind(Messages.ReviewsLabelProvider_X_Revision_Y,
+ target.getPath() == null ? target.getName() : target.getPath(),
+ target.getDescription());
+ }
}
}
if (element instanceof IUser) {

Back to the top