Class GitChangeLogConsumer
- java.lang.Object
-
- org.apache.maven.scm.util.AbstractConsumer
-
- org.apache.maven.scm.provider.git.gitexe.command.changelog.GitChangeLogConsumer
-
- All Implemented Interfaces:
org.codehaus.plexus.util.cli.StreamConsumer
public class GitChangeLogConsumer extends AbstractConsumer
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.regex.PatternAUTHOR_PATTERNThe pattern used to match git author lines.private ChangeSetcurrentChangeThe current log entry being processed by the parser.private java.lang.StringBuildercurrentCommentThe current comment of the entry being processed by the parser.private java.lang.StringcurrentRevisionThe current revision of the entry being processed by the parser.private static java.util.regex.PatternDATE_PATTERNThe pattern used to match git date lines.private java.util.List<ChangeSet>entriesList of change log entries.private static java.util.regex.PatternFILE_PATTERNThe pattern used to match git file lines.private static java.lang.StringGIT_TIMESTAMP_PATTERNDate 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.PatternHEADER_PATTERNThe pattern used to match git header lines.private static java.util.regex.PatternRAW_AUTHOR_PATTERNThe pattern used to match git author lines (raw mode)private static java.util.regex.PatternRAW_COMMITTER_PATTERNThe pattern used to match git author lines (raw mode)private static java.util.regex.PatternRAW_PARENT_PATTERNThe pattern used to match git parent hash lines (raw mode)private static java.util.regex.PatternRAW_TREE_PATTERNThe pattern used to match git tree hash lines (raw mode)private intstatusCurrent status of the parser.private static intSTATUS_GET_AUTHORState machine constant: expecting author information.private static intSTATUS_GET_COMMENTState machine constant: expecting comments.private static intSTATUS_GET_DATEState machine constant: expecting date information.private static intSTATUS_GET_FILEState machine constant: expecting file information.private static intSTATUS_GET_HEADERState machine constant: expecting header.private static intSTATUS_RAW_AUTHORState machine constant: expecting author name, email and timestamp information.private static intSTATUS_RAW_COMMITTERState machine constant: expecting committer name, email and timestamp information.private static intSTATUS_RAW_PARENTState machine constant: expecting parent hash information.private static intSTATUS_RAW_TREEState machine constant: expecting parent hash information.private java.lang.StringuserDateFormat-
Fields inherited from class org.apache.maven.scm.util.AbstractConsumer
logger
-
-
Constructor Summary
Constructors Constructor Description GitChangeLogConsumer(java.lang.String userDateFormat)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddParentRevision(java.lang.String hash)In git log, both parent and merged revisions are called parent.voidconsumeLine(java.lang.String line)java.util.List<ChangeSet>getModifications()private voidprocessGetAuthor(java.lang.String line)Process the current input line in the STATUS_GET_AUTHOR state.private voidprocessGetComment(java.lang.String line)Process the current input line in the GET_COMMENT state.private voidprocessGetDate(java.lang.String line, java.util.Locale locale)Process the current input line in the STATUS_GET_DATE state.private voidprocessGetFile(java.lang.String line)Process the current input line in the GET_FILE state.private voidprocessGetHeader(java.lang.String line)Process the current input line in the GET_HEADER state.private voidprocessGetRawAuthor(java.lang.String line)Process the current input line in the STATUS_RAW_AUTHOR state.private voidprocessGetRawCommitter(java.lang.String line)Process the current input line in the STATUS_RAW_AUTHOR state.private voidprocessGetRawParent(java.lang.String line)Process the current input line in the STATUS_RAW_PARENT state.private voidprocessGetRawTree(java.lang.String line)Process the current input line in the STATUS_RAW_TREE state.private voidresetChangeLog()-
Methods inherited from class org.apache.maven.scm.util.AbstractConsumer
parseDate, parseDate
-
-
-
-
Field Detail
-
GIT_TIMESTAMP_PATTERN
private static final 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.- See Also:
- Constant Field Values
-
STATUS_GET_HEADER
private static final int STATUS_GET_HEADER
State machine constant: expecting header.- See Also:
- Constant Field Values
-
STATUS_GET_AUTHOR
private static final int STATUS_GET_AUTHOR
State machine constant: expecting author information.- See Also:
- Constant Field Values
-
STATUS_RAW_TREE
private static final int STATUS_RAW_TREE
State machine constant: expecting parent hash information.- See Also:
- Constant Field Values
-
STATUS_RAW_PARENT
private static final int STATUS_RAW_PARENT
State machine constant: expecting parent hash information.- See Also:
- Constant Field Values
-
STATUS_RAW_AUTHOR
private static final int STATUS_RAW_AUTHOR
State machine constant: expecting author name, email and timestamp information.- See Also:
- Constant Field Values
-
STATUS_RAW_COMMITTER
private static final int STATUS_RAW_COMMITTER
State machine constant: expecting committer name, email and timestamp information.- See Also:
- Constant Field Values
-
STATUS_GET_DATE
private static final int STATUS_GET_DATE
State machine constant: expecting date information.- See Also:
- Constant Field Values
-
STATUS_GET_FILE
private static final int STATUS_GET_FILE
State machine constant: expecting file information.- See Also:
- Constant Field Values
-
STATUS_GET_COMMENT
private static final int STATUS_GET_COMMENT
State machine constant: expecting comments.- See Also:
- Constant Field Values
-
HEADER_PATTERN
private static final java.util.regex.Pattern HEADER_PATTERN
The pattern used to match git header lines.
-
AUTHOR_PATTERN
private static final java.util.regex.Pattern AUTHOR_PATTERN
The pattern used to match git author lines.
-
RAW_TREE_PATTERN
private static final java.util.regex.Pattern RAW_TREE_PATTERN
The pattern used to match git tree hash lines (raw mode)
-
RAW_PARENT_PATTERN
private static final java.util.regex.Pattern RAW_PARENT_PATTERN
The pattern used to match git parent hash lines (raw mode)
-
RAW_AUTHOR_PATTERN
private static final java.util.regex.Pattern RAW_AUTHOR_PATTERN
The pattern used to match git author lines (raw mode)
-
RAW_COMMITTER_PATTERN
private static final java.util.regex.Pattern RAW_COMMITTER_PATTERN
The pattern used to match git author lines (raw mode)
-
DATE_PATTERN
private static final java.util.regex.Pattern DATE_PATTERN
The pattern used to match git date lines.
-
FILE_PATTERN
private static final java.util.regex.Pattern FILE_PATTERN
The pattern used to match git file lines.
-
status
private int status
Current status of the parser.
-
entries
private final java.util.List<ChangeSet> entries
List of change log entries.
-
currentChange
private ChangeSet currentChange
The current log entry being processed by the parser.
-
currentRevision
private java.lang.String currentRevision
The current revision of the entry being processed by the parser.
-
currentComment
private java.lang.StringBuilder currentComment
The current comment of the entry being processed by the parser.
-
userDateFormat
private final java.lang.String userDateFormat
-
-
Method Detail
-
getModifications
public java.util.List<ChangeSet> getModifications()
-
consumeLine
public void consumeLine(java.lang.String line)
-
processGetHeader
private void processGetHeader(java.lang.String line)
Process the current input line in the GET_HEADER state. The author, date, and the revision of the entry are gathered. Note, Git does not have per-file revisions, instead, the entire branch is given a single revision number, which is also used for the revision number of each file.- Parameters:
line- a line of text from the git log output
-
processGetAuthor
private void processGetAuthor(java.lang.String line)
Process the current input line in the STATUS_GET_AUTHOR state. This state gathers all of the author information that are part of a log entry.- Parameters:
line- a line of text from the git log output
-
processGetRawTree
private void processGetRawTree(java.lang.String line)
Process the current input line in the STATUS_RAW_TREE state. This state gathers tree hash part of a log entry.- Parameters:
line- a line of text from the git log output
-
processGetRawParent
private void processGetRawParent(java.lang.String line)
Process the current input line in the STATUS_RAW_PARENT state. This state gathers parent revisions of a log entry.- Parameters:
line- a line of text from the git log output
-
addParentRevision
private void addParentRevision(java.lang.String hash)
In git log, both parent and merged revisions are called parent. Fortunately, the real parent comes first in the log. This method takes care of the difference.- Parameters:
hash- -
-
processGetRawAuthor
private void processGetRawAuthor(java.lang.String line)
Process the current input line in the STATUS_RAW_AUTHOR state. This state gathers all the author information of a log entry.- Parameters:
line- a line of text from the git log output
-
processGetRawCommitter
private void processGetRawCommitter(java.lang.String line)
Process the current input line in the STATUS_RAW_AUTHOR state. This state gathers all the committer information of a log entry.- Parameters:
line- a line of text from the git log output
-
processGetDate
private void processGetDate(java.lang.String line, java.util.Locale locale)Process the current input line in the STATUS_GET_DATE state. This state gathers all of the date information that are part of a log entry.- Parameters:
line- a line of text from the git 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 git log output
-
processGetFile
private void processGetFile(java.lang.String line)
Process the current input line in the GET_FILE state. This state adds each file entry line to the current change log entry. Note, the revision number for the entire entry is used for the revision number of each file.- Parameters:
line- a line of text from the git log output
-
resetChangeLog
private void resetChangeLog()
-
-