[MCHANGELOG-63] Tag-based reports have new headers, SCM-comments with newlines get linebreaks in HTML, lay-out update on changelog-report
Submitted by: Roland Asmann

o Applied the first part of the patch for this issue, with modifications: creating more appropriate headings when using type=tags.

git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@553625 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/maven/plugin/changelog/ChangeLogHandler.java b/src/main/java/org/apache/maven/plugin/changelog/ChangeLogHandler.java
index 765690d..ba2364d 100644
--- a/src/main/java/org/apache/maven/plugin/changelog/ChangeLogHandler.java
+++ b/src/main/java/org/apache/maven/plugin/changelog/ChangeLogHandler.java
@@ -21,6 +21,7 @@
 
 import org.apache.maven.scm.ChangeFile;
 import org.apache.maven.scm.ChangeSet;
+import org.apache.maven.scm.ScmTag;
 import org.apache.maven.scm.command.changelog.ChangeLogSet;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
@@ -222,6 +223,8 @@
             }
 
             bufSet = new ChangeLogSet( bufEntries, startDate, endDate );
+            bufSet.setStartVersion( new ScmTag( attributes.getValue( "startTag" ) ) );
+            bufSet.setEndVersion( new ScmTag( attributes.getValue( "endTag" ) ) );
         }
     }
 }
diff --git a/src/main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java b/src/main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java
index 7568ce0..73dc8f6 100644
--- a/src/main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java
+++ b/src/main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java
@@ -463,7 +463,8 @@
                 }
                 else
                 {
-                    result = provider.changeLog( repository, new ScmFileSet( basedir ), startTag, endTag );
+                    result = provider.changeLog( repository, new ScmFileSet( basedir ), new ScmRevision( startTag ),
+                                                 new ScmRevision( endTag ) );
 
                     checkResult( result );
 
@@ -516,7 +517,7 @@
         }
         catch ( MojoExecutionException e )
         {
-            throw new MavenReportException( "An error is occurred during changelog command : ", e );
+            throw new MavenReportException( "An error has occurred during changelog command : ", e );
         }
     }
 
@@ -867,7 +868,25 @@
 
         SimpleDateFormat headingDateFormater = new SimpleDateFormat( headingDateFormat );
 
-        if ( set.getStartDate() == null )
+        if ( "tag".equals( type ) )
+        {
+            if ( set.getStartVersion() == null || set.getStartVersion().getName() == null )
+            {
+                sink.text( bundle.getString( "report.SetTagCreation" ) );
+            }
+            else if ( set.getEndVersion() == null || set.getEndVersion().getName() == null )
+            {
+                sink.text( bundle.getString( "report.SetTagSince" ) );
+                sink.text( " '" + set.getStartVersion() + "'" );
+            }
+            else
+            {
+                sink.text( bundle.getString( "report.SetTagBetween" ) );
+                sink.text( " '" + set.getStartVersion() + "' " + bundle.getString( "report.And" ) + " '"
+                    + set.getEndVersion() + "'" );
+            }
+        }
+        else  if ( set.getStartDate() == null )
         {
             sink.text( bundle.getString( "report.SetRangeUnknown" ) );
         }
diff --git a/src/main/resources/scm-activity.properties b/src/main/resources/scm-activity.properties
index 64db227..7c8313b 100644
--- a/src/main/resources/scm-activity.properties
+++ b/src/main/resources/scm-activity.properties
@@ -20,6 +20,9 @@
 report.SetRangeUnknown=Changes from an unknown range
 report.SetRangeSince=Changes since
 report.SetRangeBetween=Changes between
+report.SetTagCreation=Changes since project creation
+report.SetTagSince=Changes since tag
+report.SetTagBetween=Changes between tags
 report.To=to
 report.TotalCommits=Total commits