fix wrong regex for commit-refs

Tue, 25 Jul 2023 18:19:04 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 25 Jul 2023 18:19:04 +0200
changeset 288
10324c383126
parent 287
2aabfe7709c4
child 289
d702bdd4da51

fix wrong regex for commit-refs

and also adds some more - fixes #279

build.gradle.kts file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/types/CommitRef.kt file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/changelogs/changelog-de.jspf file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/changelogs/changelog.jspf file | annotate | diff | comparison | revisions
src/test/kotlin/de/uapcore/lightpit/types/CommitRefTest.kt file | annotate | diff | comparison | revisions
--- a/build.gradle.kts	Sun Jul 23 18:57:33 2023 +0200
+++ b/build.gradle.kts	Tue Jul 25 18:19:04 2023 +0200
@@ -5,7 +5,7 @@
     war
 }
 group = "de.uapcore"
-version = "1.1.0"
+version = "1.1.1"
 
 repositories {
     mavenCentral()
--- a/src/main/kotlin/de/uapcore/lightpit/types/CommitRef.kt	Sun Jul 23 18:57:33 2023 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/types/CommitRef.kt	Tue Jul 25 18:19:04 2023 +0200
@@ -53,7 +53,7 @@
         if (currentHash.isEmpty()) continue
 
         // scan the lines for commit references
-        Regex("""(?:relates to|fix(?:es)?|close(?:es)?) #(\d+)""")
+        Regex("""(?:issue|relates? to|fix(?:e[sd])?|close(?:[sd])?) \#(\d+)""")
             .findAll(line)
             .map { it.groupValues[1] }
             .map { it.toIntOrNull() }
--- a/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Sun Jul 23 18:57:33 2023 +0200
+++ b/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Tue Jul 25 18:19:04 2023 +0200
@@ -24,6 +24,15 @@
   --%>
 <%@ page contentType="text/html;charset=UTF-8" %>
 
+<h3>Version 1.1.1</h3>
+
+<ul>
+    <li>
+        Fehlende Unterstützung für Commit-Referenzen hinzugefügt. Es werden nun unterstützt:<br>
+        issue, relate to, relates to, fix, fixes, fixed, close, closes, closed
+    </li>
+</ul>
+
 <h3>Version 1.1.0</h3>
 
 <ul>
--- a/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Sun Jul 23 18:57:33 2023 +0200
+++ b/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Tue Jul 25 18:19:04 2023 +0200
@@ -24,6 +24,15 @@
   --%>
 <%@ page contentType="text/html;charset=UTF-8" %>
 
+<h3>Version 1.1.1</h3>
+
+<ul>
+    <li>
+        Add support for missing commit-ref verbs. Now supported are:<br>
+        issue, relate to, relates to, fix, fixes, fixed, close, closes, closed
+    </li>
+</ul>
+
 <h3>Version 1.1.0</h3>
 
 <ul>
--- a/src/test/kotlin/de/uapcore/lightpit/types/CommitRefTest.kt	Sun Jul 23 18:57:33 2023 +0200
+++ b/src/test/kotlin/de/uapcore/lightpit/types/CommitRefTest.kt	Tue Jul 25 18:19:04 2023 +0200
@@ -32,30 +32,33 @@
 class CommitRefTest {
 
     @Test
-    fun readCommitLog() {
+    fun parseCommitRefs() {
         assertContentEquals(
             listOf(
                 CommitRef("cf9f5982ddeb28c7f695dc547fe73abf5460016f", 50, "here we fix #50"),
                 CommitRef("cf9f5982ddeb28c7f695dc547fe73abf5460016f", 30, "here we fix #50"),
+                CommitRef("cf9f5982ddeb28c7f695dc547fe73abf5460016f", 80, "here we fix #50"),
                 CommitRef(
                     "ed7134e5f4ce278c4f62798fb9f96129be2b132b",
                     1337,
-                    "commit with a #non-ref, relates to #wrong ref but still fixes #1337"
+                    "commit with a #non-ref, relates to #wrong ref but still closes #1337"
                 ),
-                CommitRef("74d770da3c80c0c3fc1fb7e44fb710d665127dfe", 47, "a change with commitref in body"),
-                CommitRef("9a14e5628bdf2d578f3385d78022ddcaf23d1abb", 47, "add test file - relates to #47")
+                CommitRef("74d770da3c80c0c3fc1fb7e44fb710d665127dfe", 47, "a change with commitrefs only in body"),
+                CommitRef("74d770da3c80c0c3fc1fb7e44fb710d665127dfe", 13, "a change with commitrefs only in body"),
+                CommitRef("9a14e5628bdf2d578f3385d78022ddcaf23d1abb", 47, "add test file - closed #47 and fixed #90"),
+                CommitRef("9a14e5628bdf2d578f3385d78022ddcaf23d1abb", 90, "add test file - closed #47 and fixed #90")
             ),
-            parseCommitRefs(
-                """::lpitref:cf9f5982ddeb28c7f695dc547fe73abf5460016f:here we fix #50
+            parseCommitRefs("""
+::lpitref:cf9f5982ddeb28c7f695dc547fe73abf5460016f:here we fix #50
 
-and close #30
-::lpitref:ed7134e5f4ce278c4f62798fb9f96129be2b132b:commit with a #non-ref, relates to #wrong ref but still fixes #1337
-::lpitref:74d770da3c80c0c3fc1fb7e44fb710d665127dfe:a change with commitref in body
+and close #30 which blocked issue #80
+::lpitref:ed7134e5f4ce278c4f62798fb9f96129be2b132b:commit with a #non-ref, relates to #wrong ref but still closes #1337
+::lpitref:74d770da3c80c0c3fc1fb7e44fb710d665127dfe:a change with commitrefs only in body
 
 some more details
-fixes #47
+fixes #47 and relates to #13
 ::lpitref:d533c717dfecb8e4b993ca6c8760f1493bc834b6:no commitref
-::lpitref:9a14e5628bdf2d578f3385d78022ddcaf23d1abb:add test file - relates to #47
+::lpitref:9a14e5628bdf2d578f3385d78022ddcaf23d1abb:add test file - closed #47 and fixed #90
 """
             )
         )

mercurial