This is an automated email from the ASF dual-hosted git repository. kwin pushed a commit to branch feature/infoitem-tostring in repository https://gitbox.apache.org/repos/asf/maven-scm.git
commit 5c14b1617cfea3f7e396cb18ee7ef357aae69c4e Author: Konrad Windszus <[email protected]> AuthorDate: Mon Mar 30 18:01:00 2026 +0200 Add toString()/equals()/hashCode() for InfoItem --- .../apache/maven/scm/command/info/InfoItem.java | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/maven-scm-api/src/main/java/org/apache/maven/scm/command/info/InfoItem.java b/maven-scm-api/src/main/java/org/apache/maven/scm/command/info/InfoItem.java index 1120d6440..cbac0ff67 100644 --- a/maven-scm-api/src/main/java/org/apache/maven/scm/command/info/InfoItem.java +++ b/maven-scm-api/src/main/java/org/apache/maven/scm/command/info/InfoItem.java @@ -20,6 +20,7 @@ import java.time.OffsetDateTime; import java.time.temporal.TemporalAccessor; +import java.util.Objects; /** * Encapsulates meta information about a file (or directory) being managed with an SCM. @@ -156,4 +157,69 @@ public OffsetDateTime getLastChangedDateTime() { public void setLastChangedDateTime(TemporalAccessor accessor) { this.lastChangedDateTime = OffsetDateTime.from(accessor); } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("InfoItem ["); + if (path != null) { + builder.append("path=").append(path).append(", "); + } + if (url != null) { + builder.append("url=").append(url).append(", "); + } + if (repositoryRoot != null) { + builder.append("repositoryRoot=").append(repositoryRoot).append(", "); + } + if (repositoryUUID != null) { + builder.append("repositoryUUID=").append(repositoryUUID).append(", "); + } + if (revision != null) { + builder.append("revision=").append(revision).append(", "); + } + if (nodeKind != null) { + builder.append("nodeKind=").append(nodeKind).append(", "); + } + if (schedule != null) { + builder.append("schedule=").append(schedule).append(", "); + } + if (lastChangedAuthor != null) { + builder.append("lastChangedAuthor=").append(lastChangedAuthor).append(", "); + } + if (lastChangedRevision != null) { + builder.append("lastChangedRevision=").append(lastChangedRevision).append(", "); + } + if (lastChangedDate != null) { + builder.append("lastChangedDate=").append(lastChangedDate).append(", "); + } + if (lastChangedDateTime != null) { + builder.append("lastChangedDateTime=").append(lastChangedDateTime); + } + builder.append("]"); + return builder.toString(); + } + + @Override + public int hashCode() { + return Objects.hash(lastChangedAuthor, lastChangedDate, lastChangedDateTime, lastChangedRevision, nodeKind, path, repositoryRoot, + repositoryUUID, revision, schedule, url); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + InfoItem other = (InfoItem) obj; + return Objects.equals(lastChangedAuthor, other.lastChangedAuthor) && Objects.equals(lastChangedDate, other.lastChangedDate) + && Objects.equals(lastChangedDateTime, other.lastChangedDateTime) + && Objects.equals(lastChangedRevision, other.lastChangedRevision) && Objects.equals(nodeKind, other.nodeKind) + && Objects.equals(path, other.path) && Objects.equals(repositoryRoot, other.repositoryRoot) + && Objects.equals(repositoryUUID, other.repositoryUUID) && Objects.equals(revision, other.revision) + && Objects.equals(schedule, other.schedule) && Objects.equals(url, other.url); + } + }
