Methods Summary |
---|
public CVSEntry[] | getEntrySetAsArray()Get a list of rcs entries as an array.
final CVSEntry[] array = new CVSEntry[ entries.size() ];
int i = 0;
for (Enumeration e = entries.elements(); e.hasMoreElements();) {
array[i++] = (CVSEntry) e.nextElement();
}
return array;
|
private java.util.Date | parseDate(java.lang.String date)Parse date out from expected format.
try {
return INPUT_DATE.parse(date);
} catch (ParseException e) {
try {
return CVS1129_INPUT_DATE.parse(date);
} catch (ParseException e2) {
throw new IllegalStateException("Invalid date format: " + date);
}
}
|
private void | processComment(java.lang.String line)Process a line while in "GET_COMMENT" state.
final String lineSeparator = System.getProperty("line.separator");
if (line.equals(
"=============================================================================")) {
//We have ended changelog for that particular file
//so we can save it
final int end
= comment.length() - lineSeparator.length(); //was -1
comment = comment.substring(0, end);
saveEntry();
status = GET_FILE;
} else if (line.equals("----------------------------")) {
final int end
= comment.length() - lineSeparator.length(); //was -1
comment = comment.substring(0, end);
status = GET_PREVIOUS_REV;
} else {
comment += line + lineSeparator;
}
|
private void | processDate(java.lang.String line)Process a line while in "DATE" state.
if (line.startsWith("date:")) {
// The date format is using a - format since 1.12.9 so we have:
// 1.12.9-: 'date: YYYY/mm/dd HH:mm:ss; author: name;'
// 1.12.9+: 'date: YYYY-mm-dd HH:mm:ss Z; author: name'
int endOfDateIndex = line.indexOf(';");
date = line.substring("date: ".length(), endOfDateIndex);
int startOfAuthorIndex = line.indexOf("author: ", endOfDateIndex + 1);
int endOfAuthorIndex = line.indexOf(';", startOfAuthorIndex + 1);
author = line.substring("author: ".length() + startOfAuthorIndex, endOfAuthorIndex);
status = GET_COMMENT;
//Reset comment to empty here as we can accumulate multiple lines
//in the processComment method
comment = "";
}
|
private void | processFile(java.lang.String line)Process a line while in "GET_FILE" state.
if (line.startsWith("Working file:")) {
file = line.substring(14, line.length());
status = GET_REVISION;
}
|
private void | processGetPreviousRevision(java.lang.String line)Process a line while in "GET_PREVIOUS_REVISION" state.
if (!line.startsWith("revision ")) {
throw new IllegalStateException("Unexpected line from CVS: "
+ line);
}
previousRevision = line.substring("revision ".length());
saveEntry();
revision = previousRevision;
status = GET_DATE;
|
private void | processRevision(java.lang.String line)Process a line while in "REVISION" state.
if (line.startsWith("revision")) {
revision = line.substring(9);
status = GET_DATE;
} else if (line.startsWith("======")) {
//There were no revisions in this changelog
//entry so lets move onto next file
status = GET_FILE;
}
|
public void | reset()Reset all internal attributes except status.
this.file = null;
this.date = null;
this.author = null;
this.comment = null;
this.revision = null;
this.previousRevision = null;
|
private void | saveEntry()Utility method that saves the current entry.
final String entryKey = date + author + comment;
CVSEntry entry;
if (!entries.containsKey(entryKey)) {
Date dateObject = parseDate(date);
entry = new CVSEntry(dateObject, author, comment);
entries.put(entryKey, entry);
} else {
entry = (CVSEntry) entries.get(entryKey);
}
entry.addFile(file, revision, previousRevision);
|
public void | stdout(java.lang.String line)Receive notification about the process writing
to standard output.
switch(status) {
case GET_FILE:
// make sure attributes are reset when
// working on a 'new' file.
reset();
processFile(line);
break;
case GET_REVISION:
processRevision(line);
break;
case GET_DATE:
processDate(line);
break;
case GET_COMMENT:
processComment(line);
break;
case GET_PREVIOUS_REV:
processGetPreviousRevision(line);
break;
default:
// Do nothing
break;
}
|