Handle sub-patch versioning
Currently the code only handles x.y.z but
there is a possibility that Gerrit has the fourth versioning.
During such occasion the checking will fail entirely.
This patch add an optional fourth versioning number.
Change-Id: I80e7de197d13008ec3d478be84ef7a3e5426a612
Signed-off-by: Ardo Septama <aseptama@gmail.com>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/importer/GerritApi.java b/src/main/java/com/googlesource/gerrit/plugins/importer/GerritApi.java
index 88cddce..cbfc5df 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/importer/GerritApi.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/importer/GerritApi.java
@@ -82,22 +82,25 @@
final Integer major;
final Integer minor;
final Integer patch;
+ final Integer revision;
final String qualifier;
Version(String formatted) {
this.formatted = formatted;
- Matcher m = Pattern.compile("(\\d+)\\.(\\d+)(\\.(\\d+))?(-(.+))?")
+ Matcher m = Pattern.compile("(\\d+)\\.(\\d+)(\\.(\\d+))?(\\.(\\d+))?(-(.+))?")
.matcher(formatted);
if (m.matches()) {
this.major = Integer.parseInt(m.group(1));
this.minor = Integer.parseInt(m.group(2));
this.patch = m.group(3) != null ? Integer.parseInt(m.group(4)) : null;
- this.qualifier = m.group(5) != null ? m.group(6) : null;
+ this.revision = m.group(5) != null ? Integer.parseInt(m.group(6)) : null;
+ this.qualifier = m.group(7) != null ? m.group(8) : null;
} else {
this.major = null;
this.minor = null;
this.patch = null;
+ this.revision = null;
this.qualifier = null;
}
}