Browse Source

Move user extraction outside of parser to please maven peeps.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272435 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
6c1ab50a3b
3 changed files with 22 additions and 20 deletions
  1. +5
    -1
      src/main/org/apache/tools/ant/taskdefs/cvslib/CVSEntry.java
  2. +0
    -15
      src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java
  3. +17
    -4
      src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java

+ 5
- 1
src/main/org/apache/tools/ant/taskdefs/cvslib/CVSEntry.java View File

@@ -65,7 +65,7 @@ import java.util.Date;
*/
class CVSEntry {
private Date m_date;
private final String m_author;
private String m_author;
private final String m_comment;
private final Vector m_files = new Vector();

@@ -87,6 +87,10 @@ class CVSEntry {
return m_date;
}

void setAuthor(final String author) {
m_author = author;
}
String getAuthor() {
return m_author;
}


+ 0
- 15
src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java View File

@@ -91,17 +91,6 @@ class ChangeLogParser {
/** rcs entries */
private final Hashtable m_entries = new Hashtable();

private final Properties m_userList;

/**
* Construct a parser that uses specified user list.
*
* @param userList the userlist
*/
public ChangeLogParser(Properties userList) {
m_userList = userList;
}

/**
* Get a list of rcs entrys as an array.
*
@@ -210,10 +199,6 @@ class ChangeLogParser {
String lineData = line.substring(line.indexOf(";") + 1);
m_author = lineData.substring(10, lineData.indexOf(";"));

if (m_userList.containsKey(m_author)) {
m_author = m_userList.getProperty(m_author);
}

m_status = GET_COMMENT;

//Reset comment to empty here as we can accumulate multiple lines


+ 17
- 4
src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java View File

@@ -271,7 +271,7 @@ public class ChangeLogTask extends Task {
}
}

final ChangeLogParser parser = new ChangeLogParser(userList);
final ChangeLogParser parser = new ChangeLogParser();
final RedirectingStreamHandler handler =
new RedirectingStreamHandler(parser);

@@ -302,6 +302,8 @@ public class ChangeLogTask extends Task {
final CVSEntry[] entrySet = parser.getEntrySetAsArray();
final CVSEntry[] filteredEntrySet = filterEntrySet(entrySet);

replaceAuthorIdWithName(userList,filteredEntrySet);

writeChangeLog(filteredEntrySet);

} finally {
@@ -309,7 +311,6 @@ public class ChangeLogTask extends Task {
}
}


/**
* Validate the parameters specified for task.
*
@@ -339,7 +340,6 @@ public class ChangeLogTask extends Task {
}
}


/**
* Load the userlist from the userList file (if specified) and add to
* list of users.
@@ -358,7 +358,6 @@ public class ChangeLogTask extends Task {
}
}


/**
* Filter the specified entrys accoridn to an appropriate rule.
*
@@ -389,6 +388,20 @@ public class ChangeLogTask extends Task {
return resultArray;
}

/**
* replace all known author's id's with their maven specified names
*/
private void replaceAuthorIdWithName(final Properties userList,
final CVSEntry[] entrySet) {
for (int i = 0; i < entrySet.length; i++ ) {
final CVSEntry entry = entrySet[ i ];
if (userList.containsKey(entry.getAuthor()))
{
entry.setAuthor(userList.getProperty(entry.getAuthor()));
}
}
}

/**
* Print changelog to file specified in task.


Loading…
Cancel
Save