the changes in the changelog report are sorted randomnly
--------------------------------------------------------

         Key: MCHANGELOG-13
         URL: http://jira.codehaus.org/browse/MCHANGELOG-13
     Project: Maven 2.x Changelog Plugin
        Type: Bug

    Versions: 2.0    
    Reporter: Martin Johannesen
    Priority: Minor


I dont know if this is an issue with the SCM code that changelog report is 
using, but the sorting of this report is weird or nonexisting. I would think 
that this report should be sorted after datetime, so the newest changes are at 
the top of the report. Correct me if i am wrong :-)

A possible fix:

Add a comparator to the ChangeLogReport:

{code:title=ChangeLogReport.java|borderStyle=solid}
class ChangeSetComparator implements Comparator {

        public int compare(Object arg0, Object arg1) {
                ChangeSet changeSet0=(ChangeSet)arg0;
                ChangeSet changeSet1=(ChangeSet)arg1;
                return changeSet1.getDate().compareTo(changeSet0.getDate());
        }
        
}
{code} 

and change the method doChangedSetTable, adding Collections.sort :

{code:title=ChangeLogReport.java|borderStyle=solid}
 private void doChangedSetTable( List entries, ResourceBundle bundle, Sink sink 
)
    {
        sink.table();

        sink.tableRow();
        sink.tableHeaderCell();
        sink.text( bundle.getString( "report.changelog.timestamp" ) );
        sink.tableHeaderCell_();
        sink.tableHeaderCell();
        sink.text( bundle.getString( "report.changelog.author" ) );
        sink.tableHeaderCell_();
        sink.tableHeaderCell();
        sink.text( bundle.getString( "report.changelog.details" ) );
        sink.tableHeaderCell_();
        sink.tableRow_();

        
        Collections.sort(entries,new ChangeSetComparator());
        
        for ( Iterator i = entries.iterator(); i.hasNext(); )
        {
            ChangeSet entry = (ChangeSet) i.next();

            doChangedSetDetail( entry, bundle, sink );
        }

        sink.table_();
    }
{code} 


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to