summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2013-07-12 12:08:02 (EDT)
committerGerrit Code Review @ Eclipse.org2013-07-12 12:35:52 (EDT)
commitdc8dbf4b6e40e7c7fcc6b5c3d8d5dea71212fe54 (patch)
tree581eee066017810b221c5791d816c7f15283613e
parent59258d288ee77b86c622cfaf697d7078fff9b159 (diff)
downloadorg.eclipse.mylyn.reviews-dc8dbf4b6e40e7c7fcc6b5c3d8d5dea71212fe54.zip
org.eclipse.mylyn.reviews-dc8dbf4b6e40e7c7fcc6b5c3d8d5dea71212fe54.tar.gz
org.eclipse.mylyn.reviews-dc8dbf4b6e40e7c7fcc6b5c3d8d5dea71212fe54.tar.bz2
395059: display a warning if the Gerrit version is not supportedrefs/changes/02/14502/3
Bug: 395059 Change-Id: I04e7add3a8e639de8f93411bfb406f4e925fdafb Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=395059 Signed-off-by: Tomasz Zarna <tomasz.zarna@tasktop.com>
-rw-r--r--org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/tests/core/client/GerritVersionTest.java13
-rw-r--r--org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/GerritRepositorySettingsPage.java18
2 files changed, 29 insertions, 2 deletions
diff --git a/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/tests/core/client/GerritVersionTest.java b/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/tests/core/client/GerritVersionTest.java
index e00197b..1316592 100644
--- a/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/tests/core/client/GerritVersionTest.java
+++ b/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/tests/core/client/GerritVersionTest.java
@@ -11,6 +11,7 @@
package org.eclipse.mylyn.gerrit.tests.core.client;
+import static org.eclipse.mylyn.internal.gerrit.core.client.GerritVersion.isVersion26OrLater;
import static org.eclipse.mylyn.internal.gerrit.core.client.GerritVersion.parseGerritVersion;
import junit.framework.TestCase;
@@ -93,4 +94,16 @@ public class GerritVersionTest extends TestCase {
assertEquals(3, v.getMicro());
assertEquals("q", v.getQualifier());
}
+
+ @Test
+ public void testIsVersion26OrLater() throws Exception {
+ assertFalse(isVersion26OrLater(parseGerritVersion("2.5.9")));
+ assertFalse(isVersion26OrLater(parseGerritVersion("2.5.9-q")));
+ assertTrue(isVersion26OrLater(parseGerritVersion("2.6")));
+ assertTrue(isVersion26OrLater(parseGerritVersion("2.6-q")));
+ assertTrue(isVersion26OrLater(parseGerritVersion("2.6.0")));
+ assertTrue(isVersion26OrLater(parseGerritVersion("2.6.0-q")));
+ assertTrue(isVersion26OrLater(parseGerritVersion("2.6.1")));
+ assertTrue(isVersion26OrLater(parseGerritVersion("2.6.1-q")));
+ }
}
diff --git a/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/GerritRepositorySettingsPage.java b/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/GerritRepositorySettingsPage.java
index b18f292..28afb4f 100644
--- a/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/GerritRepositorySettingsPage.java
+++ b/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/GerritRepositorySettingsPage.java
@@ -22,6 +22,7 @@ import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.mylyn.commons.workbench.forms.CommonFormUtil;
import org.eclipse.mylyn.internal.gerrit.core.GerritConnector;
import org.eclipse.mylyn.internal.gerrit.core.client.GerritSystemInfo;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritVersion;
import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
import org.eclipse.mylyn.tasks.core.TaskRepository;
@@ -65,6 +66,10 @@ public class GerritRepositorySettingsPage extends AbstractRepositorySettingsPage
info = connector.validate(repository, monitor);
}
+ private boolean isSupportedVersion() {
+ return !GerritVersion.isVersion26OrLater(info.getVersion());
+ }
+
}
private class OpenIdProvider {
@@ -140,8 +145,17 @@ public class GerritRepositorySettingsPage extends AbstractRepositorySettingsPage
super.applyValidatorResult(validator);
if (validator.getStatus() != null && validator.getStatus().isOK()) {
GerritValidator gerritValidator = (GerritValidator) validator;
- setMessage(NLS.bind("{0} Logged in as {1}.", getMessage(), gerritValidator.getInfo().getFullName()),
- IMessageProvider.INFORMATION);
+
+ String warning = ""; //$NON-NLS-1$
+ if (!gerritValidator.isSupportedVersion()) {
+ warning = NLS.bind("\nPlease keep in mind that Gerrit {0} is not fully supported yet.",
+ gerritValidator.getInfo().getVersion());
+ }
+
+ setMessage(NLS.bind("{0} Logged in as {1}.{2}", new String[] { getMessage(),
+ gerritValidator.getInfo().getFullName(), warning }), warning.isEmpty()
+ ? IMessageProvider.INFORMATION
+ : IMessageProvider.WARNING);
}
}