donaldp 02/03/29 19:10:20
Modified: src/main/org/apache/tools/ant/taskdefs/cvslib
ChangeLogParser.java
Log:
Fix bug where a log of a single file without other logs in between would only
retrieve first change
Revision Changes Path
1.2 +39 -31
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java
Index: ChangeLogParser.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ChangeLogParser.java 28 Mar 2002 22:58:21 -0000 1.1
+++ ChangeLogParser.java 30 Mar 2002 03:10:20 -0000 1.2
@@ -63,7 +63,7 @@
* A class used to parse the output of the CVS log command.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
- * @version $Revision: 1.1 $ $Date: 2002/03/28 22:58:21 $
+ * @version $Revision: 1.2 $ $Date: 2002/03/30 03:10:20 $
*/
class ChangeLogParser
{
@@ -127,7 +127,8 @@
case GET_REVISION:
processRevision( line );
//Was a fall through ....
- //break;
+ break;
+
case GET_DATE:
processDate( line );
break;
@@ -150,7 +151,17 @@
private void processComment( final String line )
{
final String lineSeparator = System.getProperty( "line.separator" );
- if( line.startsWith( "======" ) || line.startsWith( "------" ) )
+ if( line.startsWith( "======" ) )
+ {
+ //We have ended changelog for that particular file
+ //so we can save it
+ final int end = m_comment.length() - lineSeparator.length();
//was -1
+ m_comment = m_comment.substring( 0, end );
+ m_comment = "<![CDATA[" + m_comment + "]]>";
+ saveEntry();
+ m_status = GET_FILE;
+ }
+ else if( line.startsWith( "------" ) )
{
final int end = m_comment.length() - lineSeparator.length();
//was -1
m_comment = m_comment.substring( 0, end );
@@ -224,39 +235,36 @@
*/
private void processGetPreviousRevision( final String line )
{
- final String entryKey = m_date + m_author + m_comment;
- if( line.startsWith( "revision" ) )
+ if( !line.startsWith( "revision" ) )
{
- m_previousRevision = line.substring( 9 );
- m_status = GET_FILE;
+ throw new IllegalStateException( "Unexpected line from CVS: " +
line );
+ }
+ m_previousRevision = line.substring( 9 );
- CVSEntry entry;
- if( !m_entries.containsKey( entryKey ) )
- {
- entry = new CVSEntry( parseDate( m_date ), m_author,
m_comment );
- m_entries.put( entryKey, entry );
- }
- else
- {
- entry = (CVSEntry)m_entries.get( entryKey );
- }
- entry.addFile( m_file, m_revision, m_previousRevision );
+ saveEntry();
+
+ m_revision = m_previousRevision;
+ m_status = GET_COMMENT;
+ }
+
+ /**
+ * Utility method that saves the current entry.
+ */
+ private void saveEntry()
+ {
+ final String entryKey = m_date + m_author + m_comment;
+ CVSEntry entry;
+ if( !m_entries.containsKey( entryKey ) )
+ {
+ entry = new CVSEntry( parseDate( m_date ), m_author, m_comment );
+ m_entries.put( entryKey, entry );
}
- else if( line.startsWith( "======" ) )
+ else
{
- m_status = GET_FILE;
- CVSEntry entry;
- if( !m_entries.containsKey( entryKey ) )
- {
- entry = new CVSEntry( parseDate( m_date ), m_author,
m_comment );
- m_entries.put( entryKey, entry );
- }
- else
- {
- entry = (CVSEntry)m_entries.get( entryKey );
- }
- entry.addFile( m_file, m_revision );
+ entry = (CVSEntry)m_entries.get( entryKey );
}
+
+ entry.addFile( m_file, m_revision, m_previousRevision );
}
/**
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>