Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfbecker2009-02-28 08:48:52 -0500
committerfbecker2009-02-28 08:48:52 -0500
commit85d864eb4d364bc358f8353336430c1565d55f7b (patch)
tree519855f2553b32052935811202eef39a81a1b0ec
parent73bee21d3e2c23524369d257bf04d0f3a4d33837 (diff)
downloadorg.eclipse.mylyn.tasks-85d864eb4d364bc358f8353336430c1565d55f7b.tar.gz
org.eclipse.mylyn.tasks-85d864eb4d364bc358f8353336430c1565d55f7b.tar.xz
org.eclipse.mylyn.tasks-85d864eb4d364bc358f8353336430c1565d55f7b.zip
ASSIGNED - bug 264092: Add support for RC to Class BugzillaVersion
https://bugs.eclipse.org/bugs/show_bug.cgi?id=264092
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java18
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaVersionTest.java11
3 files changed, 28 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java
index d4e770bbe..1b1f77488 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java
@@ -34,13 +34,25 @@ public class BugzillaVersion implements Comparable<BugzillaVersion>, Serializabl
private final int minor;
- private final int micro;
+ private int micro;
+
+ private final boolean rc;
public BugzillaVersion(String version) {
- String[] segments = version == null ? new String[0] : version.split("\\."); //$NON-NLS-1$
+ String[] segments;
+ if (version == null) {
+ segments = new String[0];
+ rc = false;
+ } else {
+ rc = version.contains("RC"); //$NON-NLS-1$
+ segments = rc ? version.split("(\\.|([R][C]))") : version.split("\\."); //$NON-NLS-1$
+ }
major = segments.length > 0 ? parse(segments[0]) : 0;
minor = segments.length > 1 ? parse(segments[1]) : 0;
micro = segments.length > 2 ? parse(segments[2]) : 0;
+ if (rc) {
+ micro -= 100;
+ }
}
private int parse(String segment) {
@@ -104,6 +116,8 @@ public class BugzillaVersion implements Comparable<BugzillaVersion>, Serializabl
sb.append(".").append(Integer.toString(minor)); //$NON-NLS-1$
if (micro > 0) {
sb.append(".").append(Integer.toString(micro)); //$NON-NLS-1$
+ } else if (micro < 0) {
+ sb.append("RC").append(Integer.toString(micro + 100)); //$NON-NLS-1$
}
return sb.toString();
}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java
index 58efe0d7a..bd95a5b74 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java
@@ -66,7 +66,7 @@ public class RepositoryConfiguration implements Serializable {
private final List<BugzillaFlag> flags = new ArrayList<BugzillaFlag>();
- private BugzillaVersion version;
+ private BugzillaVersion version = BugzillaVersion.MIN_VERSION;
public RepositoryConfiguration() {
super();
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaVersionTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaVersionTest.java
index c18663afc..675603402 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaVersionTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaVersionTest.java
@@ -38,6 +38,17 @@ public class BugzillaVersionTest extends TestCase {
assertEquals("3.0.1", version.toString());
}
+ public void testRCVersions() throws Exception {
+ BugzillaVersion versionRC1 = new BugzillaVersion("3.2RC1");
+ assertEquals("3.2RC1", versionRC1.toString());
+ BugzillaVersion versionRC2 = new BugzillaVersion("3.2RC2");
+ assertEquals("3.2RC2", versionRC2.toString());
+ assertEquals(-1, versionRC1.compareTo(versionRC2));
+ assertEquals(1, versionRC2.compareTo(versionRC1));
+ assertEquals(-1, versionRC1.compareTo(BugzillaVersion.BUGZILLA_3_2));
+ assertEquals(0, versionRC1.compareMajorMinorOnly(BugzillaVersion.BUGZILLA_3_2));
+ }
+
public void testCompareAll() throws Exception {
assertEquals(0, BUGZILLA_2_18_1.compareTo(BUGZILLA_2_18_1));
assertEquals(-1, BUGZILLA_2_18_1.compareTo(BUGZILLA_2_18_2));

Back to the top