Skip to content

The Unified and Autonomous Development Platform

Add link to explain various patterns.

robin shine57a887f5293c
diff --git a/commons.util/src/main/java/com/pmease/commons/util/pattern/PatternSetMatcher.java b/commons.util/src/main/java/com/pmease/commons/util/pattern/PatternSetMatcher.java
index 45375ef960..2fc1985f67 100644
--- a/commons.util/src/main/java/com/pmease/commons/util/pattern/PatternSetMatcher.java
+++ b/commons.util/src/main/java/com/pmease/commons/util/pattern/PatternSetMatcher.java
@@ -10,16 +10,19 @@ public class PatternSetMatcher implements PatternMatcher {
@Override
public boolean matches(String patterns, String input) {
+ boolean lastExclusive = false;
for (ExclusiveAwarePattern each: PatternSet.fromString(patterns).getPatterns()) {
if (each.isExclusive()) {
+ lastExclusive = true;
if (patternMatcher.matches(each.getPattern(), input))
return false;
} else {
+ lastExclusive = false;
if (patternMatcher.matches(each.getPattern(), input))
return true;
}
}
- return false;
+ return lastExclusive;
}
}
diff --git a/commons.util/src/test/java/com/pmease/commons/util/pattern/WildcardUtilsTest.java b/commons.util/src/test/java/com/pmease/commons/util/pattern/WildcardUtilsTest.java
index 8489ecf4bb..114b9e7619 100644
--- a/commons.util/src/test/java/com/pmease/commons/util/pattern/WildcardUtilsTest.java
+++ b/commons.util/src/test/java/com/pmease/commons/util/pattern/WildcardUtilsTest.java
@@ -9,6 +9,7 @@ public class WildcardUtilsTest {
@Test
public void shouldMatchPath() {
+ assertTrue(matchPath("-*.java", "file.c"));
assertTrue(matchPath("**//*.java", "com/example/Test.java"));
assertFalse(matchPath("**/*.java", "com/example/test.c"));
assertFalse(matchPath("com/*.java", "com/example/Test.java"));
@@ -23,6 +24,8 @@ public class WildcardUtilsTest {
assertFalse(matchPath("-**/*.java, **/*.java, **/*.c", "test/hello.txt"));
assertFalse(matchPath("-**/*.java, **/*.java, **/*.c", "test/hello.java"));
assertTrue(matchPath("+**/*.java, -**/*.java, **/*.c", "test/hello.java"));
+ assertTrue(matchPath("-**/generated/**, **/*.xml", "test/test.xml"));
+ assertFalse(matchPath("-**/generated/**, **/*.xml", "generated/test.xml"));
}
@Test
@@ -38,7 +41,7 @@ public class WildcardUtilsTest {
assertTrue(matchString("src/**/*.java", "src/com/example/Test.java"));
assertFalse(matchString("src/**/*.java", "resource/com/example/Test.java"));
- assertFalse(matchString("-*.java", "hello.c"));
+ assertTrue(matchString("-*.java", "hello.c"));
assertFalse(matchString("-*.java", "hello.java"));
assertTrue(matchString("-*.java, *", "hello.c"));
assertFalse(matchString("-*.java, *", "hello.java"));
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/asset/common.css b/commons.wicket/src/main/java/com/pmease/commons/wicket/asset/common.css
index 788418401d..391c0b855b 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/asset/common.css
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/asset/common.css
@@ -152,6 +152,8 @@ table td, table th {text-align: left;}
.editor>.polymorphic.horizontal>table>tbody>tr>td:FIRST-CHILD {padding-right: 8px;}
.editor>.polymorphic.vertical>select.type {margin-bottom: 8px;}
+.editor>table.elements .help-block {display: none;}
+
.editor>table.list.elements>tbody>tr>td.actions {width: 76px;}
.editor>table.list.elements>tbody>tr>td.actions a {margin-right: 8px;}
.editor>table.elements>tbody>tr>td.actions .handle {
diff --git a/gitop.core/src/main/java/com/pmease/gitop/core/extensions/branchmatcher/MatchBranchesByPatterns.java b/gitop.core/src/main/java/com/pmease/gitop/core/extensions/branchmatcher/MatchBranchesByPatterns.java
index fed85f9744..b5fd4ad659 100644
--- a/gitop.core/src/main/java/com/pmease/gitop/core/extensions/branchmatcher/MatchBranchesByPatterns.java
+++ b/gitop.core/src/main/java/com/pmease/gitop/core/extensions/branchmatcher/MatchBranchesByPatterns.java
@@ -14,14 +14,8 @@ public class MatchBranchesByPatterns implements BranchMatcher {
private String branchPatterns;
- @Editable(name="Branch Patterns", description="Specify branch patterns to match. Below is some examples:"
- + "<ul>"
- + "<li><i>dev/*</i>: matches all branches directly under dev."
- + "<li><i>dev/**</i>: matches all branches under dev recursively."
- + "<li><i>**</i>: matches all branches."
- + "<li><i>**/bugfix</i>: matches all branches whose last segment is bugfix."
- + "<li><i>-dev/**, **</i>: matches all branches except those under dev."
- + "</ul>")
+ @Editable(name="Branch Patterns", description=
+ "Patterns should be specified following the <a href='http://wiki.pmease.com/display/gp/Pattern+Set'>pattern set</a> format.")
@OmitName
@NotEmpty
public String getBranchPatterns() {
diff --git a/gitop.core/src/main/java/com/pmease/gitop/core/extensions/gatekeeper/helper/branchselection/SpecifyTargetBranchesByPatterns.java b/gitop.core/src/main/java/com/pmease/gitop/core/extensions/gatekeeper/helper/branchselection/SpecifyTargetBranchesByPatterns.java
index 99818e467f..6f42db591b 100644
--- a/gitop.core/src/main/java/com/pmease/gitop/core/extensions/gatekeeper/helper/branchselection/SpecifyTargetBranchesByPatterns.java
+++ b/gitop.core/src/main/java/com/pmease/gitop/core/extensions/gatekeeper/helper/branchselection/SpecifyTargetBranchesByPatterns.java
@@ -13,14 +13,8 @@ public class SpecifyTargetBranchesByPatterns implements TargetBranchSelection {
private String branchPatterns;
- @Editable(name="Branch Patterns", description="Specify branch patterns to match. Below is some examples:"
- + "<ul>"
- + "<li><i>dev/*</i>: matches all branches directly under dev."
- + "<li><i>dev/**</i>: matches all branches under dev recursively."
- + "<li><i>**</i>: matches all branches."
- + "<li><i>**/bugfix</i>: matches all branches whose last segment is bugfix."
- + "<li><i>-dev/**, **</i>: matches all branches except those under dev."
- + "</ul>")
+ @Editable(name="Branch Patterns", description=
+ "Patterns should be specified following the <a href='http://wiki.pmease.com/display/gp/Pattern+Set'>pattern set</a> format.")
@OmitName
@NotEmpty
public String getBranchPatterns() {
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.css b/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.css
index d5fe687940..a5d5eee0a4 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.css
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.css
@@ -1385,4 +1385,4 @@ table.verifications tr.not-passed .fa-times {display: inline; color: #D9534F;}
table.verifications tr.ongoing .fa-cog {display: inline; color: #F0AD4E;}
.integration-setting-page form>.editor {margin-bottom: 16px;}
-.integration-setting-page form .help-block {display: none;}
\ No newline at end of file
+.polymorphic.horizontal>table>tbody>tr>td:FIRST-CHILD {width: 360px;}
\ No newline at end of file
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/repository/settings/IntegrationSettingPage.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/repository/settings/IntegrationSettingPage.html
index 1bb60ac0c1..53ac598648 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/repository/settings/IntegrationSettingPage.html
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/repository/settings/IntegrationSettingPage.html
@@ -38,8 +38,12 @@
determines whether or not to create a merge commit even if target branch can
be fast forwarded to source branch.</li>
</ul>
+ <div class="alert alert-info">
+ <span class="fa fa-lg fa-info-circle"></span>
+ Branch patterns specified in below table should follow the <a href='http://wiki.pmease.com/display/gp/Pattern+Set'>pattern set</a> format.
+ </div>
</div>
- <form wicket:id="form" class="padder">
+ <form wicket:id="form">
<div wicket:id="feedback"></div>
<div wicket:id="editor"></div>
<a wicket:id="save" class="btn btn-primary">Save</a>
@@ -65,8 +69,12 @@
determines whether or not to create a merge commit even if target branch can
be fast forwarded to source branch.</li>
</ul>
+ <div class="alert alert-info">
+ <span class="fa fa-lg fa-info-circle"></span>
+ Branch patterns specified in below table should follow the <a href='http://wiki.pmease.com/display/gp/Pattern+Set'>pattern set</a> format.
+ </div>
</div>
- <form wicket:id="form" class="padder">
+ <form wicket:id="form">
<div wicket:id="feedback"></div>
<div wicket:id="editor"></div>
<a wicket:id="save" class="btn btn-primary">Save</a>