You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2025/12/25 23:15:35 UTC
(maven-changelog-plugin) branch fix/changelog-range-dates created (now 86bcfb5)
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a change to branch fix/changelog-range-dates
in repository https://gitbox.apache.org/repos/asf/maven-changelog-plugin.git
at 86bcfb5 Fix changelog range type to use actual dates instead of null
This branch includes the following new commits:
new 86bcfb5 Fix changelog range type to use actual dates instead of null
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(maven-changelog-plugin) 01/01: Fix changelog range type to use actual dates instead of null
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch fix/changelog-range-dates
in repository https://gitbox.apache.org/repos/asf/maven-changelog-plugin.git
commit 86bcfb5862487eeedc3d26c418d3b14b0f2c879a
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Thu Dec 25 23:13:16 2025 +0000
Fix changelog range type to use actual dates instead of null
When type='range', the plugin was passing null for both startDate and
endDate to the SCM provider, relying on the numDays parameter. This
worked with 'git whatchanged' which had implicit date limiting, but
fails with 'git log' which requires explicit --since/--until dates.
Now the range (number of days) is converted to actual Date objects
before being passed to the SCM provider, ensuring proper date
filtering regardless of the underlying SCM command.
Uses java.time API (Instant/ChronoUnit) instead of deprecated
Calendar for date manipulation.
Fixes: #200
---
.../org/apache/maven/plugins/changelog/ChangeLogReport.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/maven/plugins/changelog/ChangeLogReport.java b/src/main/java/org/apache/maven/plugins/changelog/ChangeLogReport.java
index 93221b4..0d880e0 100644
--- a/src/main/java/org/apache/maven/plugins/changelog/ChangeLogReport.java
+++ b/src/main/java/org/apache/maven/plugins/changelog/ChangeLogReport.java
@@ -32,6 +32,8 @@ import java.net.URLEncoder;
import java.nio.file.Files;
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
@@ -572,8 +574,14 @@ public class ChangeLogReport extends AbstractMavenReport {
ChangeLogScmResult result;
if ("range".equals(type)) {
+ // Calculate start and end dates based on the range (number of days)
+ Instant endInstant = Instant.now();
+ Instant startInstant = endInstant.minus(range, ChronoUnit.DAYS);
+ Date endDate = Date.from(endInstant);
+ Date startDate = Date.from(startInstant);
+
result = provider.changeLog(
- repository, new ScmFileSet(basedir), null, null, range, (ScmBranch) null, dateFormat);
+ repository, new ScmFileSet(basedir), startDate, endDate, 0, (ScmBranch) null, dateFormat);
checkResult(result);