/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/**
* Reads and filters out junk from a SCCS history file
* see sccsfile(4) for details of the file format
* Wrote it since invoking sccs prs for each file was
* taking a lot of time. Time to index history has reduced 4 to 1!
*/
class SCCSHistoryParser {
boolean pass;
boolean passRecord;
boolean active;
int field;
boolean sep;
try {
} catch (IOException ioe) {
throw new HistoryException(ioe);
}
}
if (f == null) {
return null;
}
passRecord = true;
active = true;
field = 0;
while (next()) {
}
return history;
}
/**
* Read a single line of delta record
*
* @throws java.io.IOException
* @return a String representing a single log delta entry
* rev date time author comments(s)
*/
sep = true;
int c;
while ((c = read()) > 01) {
}
// to flag that revision needs to be re populated if you really need it
}
private void initFields() {
if (f.length > 5) {
revision = f[1];
try {
} catch (ParseException e) {
+ e.getMessage());
}
author = f[4];
comment = f[5];
} else {
}
}
}
/**
* @return get the revision string of current log record
*/
initFields();
return revision;
}
/**
* @return get the date assosiated with current log record
*/
initFields();
return rdate;
}
/**
* @return get the author of current log record
*/
initFields();
return author;
}
/**
* @return get the comments of current log record
*/
initFields();
return comment;
}
private boolean isActive() {
return active;
}
int c, d, dt;
switch (c) { //NOPMD
case 01:
switch (d) {
case 'c':
case 't':
case 'u':
if(d != ' ') {
return (d);
}
pass = true;
break;
case 'd':
if (d == ' ') {
if (dt == 'R') {
active = false;
} else {
active = true;
}
passRecord = true;
field = 1;
} else {
return (d);
}
break;
case -1:
case 'I': //the file contents start
case 'D':
case 'E':
case 'T':
return(-1);
case 'e':
pass = false;
if (sep && passRecord) {
return 01;
}
passRecord = true;
break;
default:
pass = false;
}
break;
case ' ':
if (passRecord) {
if (field > 0) {
field ++;
pass = true;
}
if(field > 5) {
field = 0;
pass = false;
return(c);
}
}
default:
if (pass && passRecord) {
return(c);
}
}
}
return(-1);
}
{
}
{
if (!f.exists()) {
return null;
}
return f;
}
}