Class PerforceChangeLogConsumer
- java.lang.Object
-
- org.apache.maven.scm.util.AbstractConsumer
-
- org.apache.maven.scm.provider.perforce.command.changelog.PerforceChangeLogConsumer
-
- All Implemented Interfaces:
org.codehaus.plexus.util.cli.StreamConsumer
public class PerforceChangeLogConsumer extends AbstractConsumer
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringCOMMENT_DELIMITERThe comment section ends with a blank lineprivate ChangeSetcurrentChangeThe current log entry being processed by the parserprivate java.lang.StringcurrentFilethe current file being processed by the parserprivate java.util.DateendDateprivate java.util.List<ChangeSet>entriesprivate static java.lang.StringFILE_BEGIN_TOKENA file line begins with two slashesprivate static intGET_COMMENTState machine constant: expecting commentsprivate static intGET_COMMENT_BEGINState machine constant: eat the first blank lineprivate static intGET_REVISIONState machine constant: expecting revision and/or file informationprivate static java.util.regex.PatternPATTERNThe regular expression used to match header linesprivate static java.lang.StringPERFORCE_TIMESTAMP_PATTERNDate formatter for perforce timestampprivate java.lang.StringrepoPathThe location of files within the Perforce depot that we are processing e.g.private java.util.DatestartDateprivate intstatusCurrent status of the parserprivate java.lang.StringuserDatePattern
-
Constructor Summary
Constructors Constructor Description PerforceChangeLogConsumer(java.lang.String path, java.util.Date startDate, java.util.Date endDate, java.lang.String userDatePattern, ScmLogger logger)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddEntry(ChangeSet entry, ChangeFile file)Add a change log entry to the list (if it's not already there) with the given file.voidconsumeLine(java.lang.String line)java.util.List<ChangeSet>getModifications()private voidprocessGetComment(java.lang.String line)Process the current input line in the GET_COMMENT state.private voidprocessGetRevision(java.lang.String line)Most of the relevant info is on the revision line matching the 'pattern' string.-
Methods inherited from class org.apache.maven.scm.util.AbstractConsumer
getLogger, parseDate, parseDate, setLogger
-
-
-
-
Field Detail
-
PERFORCE_TIMESTAMP_PATTERN
private static final java.lang.String PERFORCE_TIMESTAMP_PATTERN
Date formatter for perforce timestamp- See Also:
- Constant Field Values
-
entries
private java.util.List<ChangeSet> entries
-
GET_REVISION
private static final int GET_REVISION
State machine constant: expecting revision and/or file information- See Also:
- Constant Field Values
-
GET_COMMENT_BEGIN
private static final int GET_COMMENT_BEGIN
State machine constant: eat the first blank line- See Also:
- Constant Field Values
-
GET_COMMENT
private static final int GET_COMMENT
State machine constant: expecting comments- See Also:
- Constant Field Values
-
COMMENT_DELIMITER
private static final java.lang.String COMMENT_DELIMITER
The comment section ends with a blank line- See Also:
- Constant Field Values
-
FILE_BEGIN_TOKEN
private static final java.lang.String FILE_BEGIN_TOKEN
A file line begins with two slashes- See Also:
- Constant Field Values
-
status
private int status
Current status of the parser
-
currentChange
private ChangeSet currentChange
The current log entry being processed by the parser
-
currentFile
private java.lang.String currentFile
the current file being processed by the parser
-
repoPath
private java.lang.String repoPath
The location of files within the Perforce depot that we are processing e.g. //depot/projects/foo/bar
-
startDate
private java.util.Date startDate
-
endDate
private java.util.Date endDate
-
userDatePattern
private java.lang.String userDatePattern
-
PATTERN
private static final java.util.regex.Pattern PATTERN
The regular expression used to match header lines
-
-
Constructor Detail
-
PerforceChangeLogConsumer
public PerforceChangeLogConsumer(java.lang.String path, java.util.Date startDate, java.util.Date endDate, java.lang.String userDatePattern, ScmLogger logger)
-
-
Method Detail
-
getModifications
public java.util.List<ChangeSet> getModifications() throws ScmException
- Throws:
ScmException
-
consumeLine
public void consumeLine(java.lang.String line)
-
addEntry
private void addEntry(ChangeSet entry, ChangeFile file)
Add a change log entry to the list (if it's not already there) with the given file.- Parameters:
entry- aChangeSetto be added to the list if another with the same key (p4 change number) doesn't exist already.file- aChangeFileto be added to the entry
-
processGetRevision
private void processGetRevision(java.lang.String line)
Most of the relevant info is on the revision line matching the 'pattern' string.- Parameters:
line- A line of text from the perforce log output
-
processGetComment
private void processGetComment(java.lang.String line)
Process the current input line in the GET_COMMENT state. This state gathers all of the comments that are part of a log entry.- Parameters:
line- a line of text from the perforce log output
-
-