From b2f87e787f29269e4e750d9432c5af7fbc7680de Mon Sep 17 00:00:00 2001 From: ltheussl Date: Wed, 18 Jan 2006 00:12:15 +0000 Subject: [PATCH] PR: MPCHANGELOG-69 Changelog returns 0 entries on Windows with CVS (not CVSNT). New property maven.changelog.quoteDate. git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@369970 13f79535-47bb-0310-9956-ffa450edef68 --- changelog/plugin.jelly | 1 + changelog/plugin.properties | 1 + .../org/apache/maven/changelog/ChangeLog.java | 26 ++++++++++++- .../maven/cvslib/CvsChangeLogGenerator.java | 38 ++++++++++++++++++- changelog/xdocs/changes.xml | 1 + changelog/xdocs/properties.xml | 9 +++++ 6 files changed, 74 insertions(+), 2 deletions(-) diff --git a/changelog/plugin.jelly b/changelog/plugin.jelly index 0c98cce3..d522da36 100644 --- a/changelog/plugin.jelly +++ b/changelog/plugin.jelly @@ -102,6 +102,7 @@ range="${maven.changelog.range}" date="${maven.changelog.date}" tag="${maven.changelog.tag}" + quoteDate="${maven.changelog.quoteDate}" repositoryConnection="${_connection}" dateFormat="${maven.changelog.dateformat}" commentFormat="${maven.changelog.commentFormat}" diff --git a/changelog/plugin.properties b/changelog/plugin.properties index e554e3e9..b8b57b96 100644 --- a/changelog/plugin.properties +++ b/changelog/plugin.properties @@ -28,3 +28,4 @@ maven.changelog.range = 30 #maven.changelog.date = #maven.changelog.tag = +maven.changelog.quoteDate=false diff --git a/changelog/src/main/org/apache/maven/changelog/ChangeLog.java b/changelog/src/main/org/apache/maven/changelog/ChangeLog.java index 3318ba41..92998ab9 100644 --- a/changelog/src/main/org/apache/maven/changelog/ChangeLog.java +++ b/changelog/src/main/org/apache/maven/changelog/ChangeLog.java @@ -80,6 +80,11 @@ public class ChangeLog */ private String dateFormat; + /** + * Specifies whether to quote date argument (used by CvsChangeLogGenerator). + */ + private boolean quoteDate; + /** * Input dir. Working directory for running CVS executable */ @@ -302,7 +307,26 @@ public class ChangeLog { return dateFormat; } - + + /** + * Set the quoteDate property. + * @param newQuoteDate the quoteDate property to set. + */ + public void setQuoteDate(boolean newQuoteDate) + { + this.quoteDate = newQuoteDate; + } + + /** + * Get the quoteDate property. + * + * @return the quoteDate property. + */ + public boolean getQuoteDate() + { + return quoteDate; + } + /** * Set the base directory for the change log generator. * @param base the base directory diff --git a/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogGenerator.java b/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogGenerator.java index 46edeb22..766bb908 100644 --- a/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogGenerator.java +++ b/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogGenerator.java @@ -28,6 +28,7 @@ import java.util.Date; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.maven.changelog.AbstractChangeLogGenerator; +import org.apache.maven.changelog.ChangeLog; import org.apache.maven.changelog.ChangeLogParser; import org.apache.maven.util.AsyncStreamReader; import org.apache.maven.util.RepositoryUtils; @@ -54,6 +55,8 @@ class CvsChangeLogGenerator extends AbstractChangeLogGenerator private static final Log LOG = LogFactory.getLog(CvsChangeLogGenerator.class); + private boolean quoteDate; + public static final int POS_SCM = 0; public static final int POS_SCM_TYPE = 1; public static final int POS_SCM_SUBTYPE = 2; @@ -61,6 +64,39 @@ class CvsChangeLogGenerator extends AbstractChangeLogGenerator public static final int POS_SCM_PATH = 4; public static final int POS_SCM_MODULE = 5; + + /** + * Set the quoteDate property. + * @param newQuoteDate the quoteDate property to set. + */ + public void setQuoteDate(boolean newQuoteDate) + { + this.quoteDate = newQuoteDate; + } + + /** + * Get the quoteDate property. + * + * @return the quoteDate property. + */ + public boolean getQuoteDate() + { + return quoteDate; + } + + + /** + * Initialize the generator from the changelog controller. + * + * @param changeLog The invoking controller (useful for logging) + * @see ChangeLogGenerator#init(ChangeLog) + */ + public void init(ChangeLog changeLog) + { + setQuoteDate(changeLog.getQuoteDate()); + super.init(changeLog); + } + /** * Execute cvslib client driving the given parser. @todo Currently the * output from the logListener is a String, which is then converted to an @@ -198,7 +234,7 @@ class CvsChangeLogGenerator extends AbstractChangeLogGenerator { SimpleDateFormat outputDate = new SimpleDateFormat("yyyy-MM-dd"); String cmd = outputDate.format(before) + "<" + outputDate.format(to); - if ( System.getProperty( "os.name" ).startsWith( "Windows" ) ) + if ( getQuoteDate() ) { cmd = "\"" + cmd + "\""; } diff --git a/changelog/xdocs/changes.xml b/changelog/xdocs/changes.xml index be5a10e1..6599c874 100644 --- a/changelog/xdocs/changes.xml +++ b/changelog/xdocs/changes.xml @@ -25,6 +25,7 @@ + Changelog returns 0 entries on Windows with CVS (not CVSNT). New property maven.changelog.quoteDate. Changelog plugin creates wrong links for Subversion repositories. New property maven.changelog.svn.baseurl. Update dependencies to match ones in maven 1.1 core and to unify them between plugins. The following dependencies are updated :
    diff --git a/changelog/xdocs/properties.xml b/changelog/xdocs/properties.xml index 70ae71f5..a496630f 100644 --- a/changelog/xdocs/properties.xml +++ b/changelog/xdocs/properties.xml @@ -146,6 +146,15 @@ Defaults to ${pom.repository.url}. + + maven.changelog.quoteDate + Yes + + Specifies whether to put quotation marks around the date argument. + This is required on some ssh clients. + Currently only used by cvs. Defaults to false. + +