This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-scm.git


The following commit(s) were added to refs/heads/master by this push:
     new 80ede7bd9 Add equals()/hashCode()/toString()
80ede7bd9 is described below

commit 80ede7bd9309d21c91f2b5fc6b6f6728f2bc4f72
Author: Konrad Windszus <[email protected]>
AuthorDate: Thu Mar 19 12:44:57 2026 +0100

    Add equals()/hashCode()/toString()
---
 .../main/java/org/apache/maven/scm/ScmFileSet.java | 31 ++++++++++++++++---
 .../main/java/org/apache/maven/scm/ScmResult.java  | 35 ++++++++++++++++++++--
 2 files changed, 60 insertions(+), 6 deletions(-)

diff --git a/maven-scm-api/src/main/java/org/apache/maven/scm/ScmFileSet.java 
b/maven-scm-api/src/main/java/org/apache/maven/scm/ScmFileSet.java
index 2b14c341f..4f69ff073 100644
--- a/maven-scm-api/src/main/java/org/apache/maven/scm/ScmFileSet.java
+++ b/maven-scm-api/src/main/java/org/apache/maven/scm/ScmFileSet.java
@@ -24,6 +24,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Objects;
 
 import org.apache.commons.lang3.StringUtils;
 import org.codehaus.plexus.util.DirectoryScanner;
@@ -182,10 +183,32 @@ public String getExcludes() {
         return this.excludes;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public String toString() {
-        return "basedir = " + basedir + "; files = " + files;
+        return "ScmFileSet [basedir=" + basedir + ", includes=" + includes + 
", excludes=" + excludes + ", files="
+                + files + "]";
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(basedir, excludes, files, includes);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        ScmFileSet other = (ScmFileSet) obj;
+        return Objects.equals(basedir, other.basedir)
+                && Objects.equals(excludes, other.excludes)
+                && Objects.equals(files, other.files)
+                && Objects.equals(includes, other.includes);
     }
 }
diff --git a/maven-scm-api/src/main/java/org/apache/maven/scm/ScmResult.java 
b/maven-scm-api/src/main/java/org/apache/maven/scm/ScmResult.java
index aeed242cd..c5efdbc06 100644
--- a/maven-scm-api/src/main/java/org/apache/maven/scm/ScmResult.java
+++ b/maven-scm-api/src/main/java/org/apache/maven/scm/ScmResult.java
@@ -19,6 +19,7 @@
 package org.apache.maven.scm;
 
 import java.io.Serializable;
+import java.util.Objects;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -39,7 +40,8 @@ public class ScmResult implements Serializable {
     public static final String PASSWORD_PLACE_HOLDER = "********";
 
     // works for SVN and git
-    private Pattern patternForUserColonPasswordAtHost = 
Pattern.compile("^.*:(.*)@.*$", Pattern.DOTALL);
+    private static final Pattern PATTERN_FOR_USER_COLON_PASSWORD_AT_HOST =
+            Pattern.compile("^.*:(.*)@.*$", Pattern.DOTALL);
 
     /**
      * Copy constructor.
@@ -109,7 +111,7 @@ public String getCommandLine() {
 
     private String masked(String commandOutput) {
         if (null != commandOutput) {
-            final Matcher passwordMatcher = 
patternForUserColonPasswordAtHost.matcher(commandOutput);
+            final Matcher passwordMatcher = 
PATTERN_FOR_USER_COLON_PASSWORD_AT_HOST.matcher(commandOutput);
             if (passwordMatcher.find()) {
                 // clear password
                 final String clearPassword = passwordMatcher.group(1);
@@ -119,4 +121,33 @@ private String masked(String commandOutput) {
         }
         return commandOutput;
     }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(commandLine, commandOutput, providerMessage, 
success);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        ScmResult other = (ScmResult) obj;
+        return Objects.equals(commandLine, other.commandLine)
+                && Objects.equals(commandOutput, other.commandOutput)
+                && Objects.equals(providerMessage, other.providerMessage)
+                && success == other.success;
+    }
+
+    @Override
+    public String toString() {
+        return "ScmResult [success=" + success + ", providerMessage=" + 
providerMessage + ", commandOutput="
+                + commandOutput + ", commandLine=" + commandLine + "]";
+    }
 }

Reply via email to