newdiff.append(diff);
return newdiff.toString();
}
protected HtmlGenerator parseLog (String log) {
HtmlGenerator g = getHtmlGenerator("CVS log of "+name);
String CVSURL = getCvsURL();
String head =
"[ <a href=\"./../\">Up to directory</a> ] · "+
"[ <a href=\""+CVSURL+"\">Back to CVS</a> ]";
g.append("<center>",head,"<hr noshade width=\"80%\"></center><p>");
g.append ("<span class=\"title\"> CVS log of ",name,"</span>\n");
g.append ("<div class=\"box\"><pre>\n");
//parse the log string
ByteArrayOutputStream out =
new ByteArrayOutputStream();
byte unparsed[] = log.getBytes();
int byteIdx = 0;
int startIdx = 0;
byte ch;
byteIdx += 7;
do {
while(byteIdx < unparsed.length) {
if( (ch = unparsed[byteIdx]) == (byte) 'n' ) {
if(byteArrayNEquals(unparsed, byteIdx-7,
pattern, 0,
7)) {
break;
}
}
byteIdx += increments[ch>=0 ? ch : 0];
}
if(++byteIdx >= unparsed.length)
break;
//we just found 'revision'
while ((byteIdx <= unparsed.length) &&
isSpace(unparsed[byteIdx])) {
byteIdx++;
}
out.write(unparsed, startIdx, byteIdx-startIdx);
startIdx = byteIdx;
//get the revision number
while ((byteIdx <= unparsed.length) &&
isDigitOrPoint(unparsed[byteIdx])) {
byteIdx++;
}
//revision number startIdx, byteIdx-1;
if (byteIdx-1 > startIdx) {
String rev = new String(unparsed,
startIdx,
byteIdx-startIdx);
try {
checkRevisionNumber(rev);
writeLinks(out, unparsed, startIdx, byteIdx-startIdx);
} catch (Exception ex) {
out.write(unparsed, startIdx, byteIdx-startIdx);
}
}
startIdx = byteIdx;
} while (byteIdx < unparsed.length) ;
// Add the last chunk of unparsed text
int length = unparsed.length-startIdx-1;
if (length > 0)
out.write(unparsed, startIdx, length);
String parsedlog = out.toString();
g.append(parsedlog);
//end of parsing
g.append ("\n</pre></div>\n");
g.append("<hr noshade width=\"80%\"><center>",head,"</center><p>");
return g;
}