public class GitChangeLogConsumer extends AbstractConsumer
Modifier and Type | Field and Description |
---|---|
private static java.util.regex.Pattern |
AUTHOR_PATTERN
The pattern used to match git author lines
|
private ChangeSet |
currentChange
The current log entry being processed by the parser
|
private java.lang.StringBuilder |
currentComment
The current comment of the entry being processed by the parser
|
private java.lang.String |
currentRevision
The current revision of the entry being processed by the parser
|
private static java.util.regex.Pattern |
DATE_PATTERN
The pattern used to match git date lines
|
private java.util.List<ChangeSet> |
entries
List of change log entries
|
private static java.util.regex.Pattern |
FILE_PATTERN
The pattern used to match git file lines
|
private static java.lang.String |
GIT_TIMESTAMP_PATTERN
Date formatter for git timestamp
we use iso format cli git log --date=iso sample : 2008-08-06 01:37:18 +0200
|
private static java.util.regex.Pattern |
HEADER_PATTERN
The pattern used to match git header lines
|
private static java.util.regex.Pattern |
RAW_AUTHOR_PATTERN
The pattern used to match git author lines (raw mode)
|
private static java.util.regex.Pattern |
RAW_COMMITTER_PATTERN
The pattern used to match git author lines (raw mode)
|
private static java.util.regex.Pattern |
RAW_PARENT_PATTERN
The pattern used to match git parent hash lines (raw mode)
|
private static java.util.regex.Pattern |
RAW_TREE_PATTERN
The pattern used to match git tree hash lines (raw mode)
|
private int |
status
Current status of the parser
|
private static int |
STATUS_GET_AUTHOR
State machine constant: expecting author information
|
private static int |
STATUS_GET_COMMENT
State machine constant: expecting comments
|
private static int |
STATUS_GET_DATE
State machine constant: expecting date information
|
private static int |
STATUS_GET_FILE
State machine constant: expecting file information
|
private static int |
STATUS_GET_HEADER
State machine constant: expecting header
|
private static int |
STATUS_RAW_AUTHOR
State machine constant: expecting author name, email and timestamp information
|
private static int |
STATUS_RAW_COMMITTER
State machine constant: expecting committer name, email and timestamp information
|
private static int |
STATUS_RAW_PARENT
State machine constant: expecting parent hash information
|
private static int |
STATUS_RAW_TREE
State machine constant: expecting parent hash information
|
private java.lang.String |
userDateFormat |
Constructor and Description |
---|
GitChangeLogConsumer(ScmLogger logger,
java.lang.String userDateFormat)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
addParentRevision(java.lang.String hash)
In git log, both parent and merged revisions are called parent.
|
void |
consumeLine(java.lang.String line) |
java.util.List<ChangeSet> |
getModifications() |
private void |
processGetAuthor(java.lang.String line)
Process the current input line in the STATUS_GET_AUTHOR state.
|
private void |
processGetComment(java.lang.String line)
Process the current input line in the GET_COMMENT state.
|
private void |
processGetDate(java.lang.String line,
java.util.Locale locale)
Process the current input line in the STATUS_GET_DATE state.
|
private void |
processGetFile(java.lang.String line)
Process the current input line in the GET_FILE state.
|
private void |
processGetHeader(java.lang.String line)
Process the current input line in the GET_HEADER state.
|
private void |
processGetRawAuthor(java.lang.String line)
Process the current input line in the STATUS_RAW_AUTHOR state.
|
private void |
processGetRawCommitter(java.lang.String line)
Process the current input line in the STATUS_RAW_AUTHOR state.
|
private void |
processGetRawParent(java.lang.String line)
Process the current input line in the STATUS_RAW_PARENT state.
|
private void |
processGetRawTree(java.lang.String line)
Process the current input line in the STATUS_RAW_TREE state.
|
private void |
resetChangeLog() |
getLogger, parseDate, parseDate, setLogger
private static final java.lang.String GIT_TIMESTAMP_PATTERN
private static final int STATUS_GET_HEADER
private static final int STATUS_GET_AUTHOR
private static final int STATUS_RAW_TREE
private static final int STATUS_RAW_PARENT
private static final int STATUS_RAW_AUTHOR
private static final int STATUS_RAW_COMMITTER
private static final int STATUS_GET_DATE
private static final int STATUS_GET_FILE
private static final int STATUS_GET_COMMENT
private static final java.util.regex.Pattern HEADER_PATTERN
private static final java.util.regex.Pattern AUTHOR_PATTERN
private static final java.util.regex.Pattern RAW_TREE_PATTERN
private static final java.util.regex.Pattern RAW_PARENT_PATTERN
private static final java.util.regex.Pattern RAW_AUTHOR_PATTERN
private static final java.util.regex.Pattern RAW_COMMITTER_PATTERN
private static final java.util.regex.Pattern DATE_PATTERN
private static final java.util.regex.Pattern FILE_PATTERN
private int status
private java.util.List<ChangeSet> entries
private ChangeSet currentChange
private java.lang.String currentRevision
private java.lang.StringBuilder currentComment
private java.lang.String userDateFormat
public GitChangeLogConsumer(ScmLogger logger, java.lang.String userDateFormat)
public java.util.List<ChangeSet> getModifications()
public void consumeLine(java.lang.String line)
private void processGetHeader(java.lang.String line)
line
- A line of text from the git log outputprivate void processGetAuthor(java.lang.String line)
line
- a line of text from the git log outputprivate void processGetRawTree(java.lang.String line)
line
- a line of text from the git log outputprivate void processGetRawParent(java.lang.String line)
line
- a line of text from the git log outputprivate void addParentRevision(java.lang.String hash)
hash
- -private void processGetRawAuthor(java.lang.String line)
line
- a line of text from the git log outputprivate void processGetRawCommitter(java.lang.String line)
line
- a line of text from the git log outputprivate void processGetDate(java.lang.String line, java.util.Locale locale)
line
- a line of text from the git log outputprivate void processGetComment(java.lang.String line)
line
- a line of text from the git log outputprivate void processGetFile(java.lang.String line)
line
- A line of text from the git log outputprivate void resetChangeLog()