in maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/blame/GitBlameConsumer.java [69:126]
public void consumeLine(String line) {
if (line == null) {
return;
}
if (expectRevisionLine) {
// this is the revision line
String parts[] = line.split("\\s", 4);
if (parts.length >= 1) {
revision = parts[0];
BlameLine oldLine = commitInfo.get(revision);
if (oldLine != null) {
// restore the commit info
author = oldLine.getAuthor();
committer = oldLine.getCommitter();
time = oldLine.getDate();
}
expectRevisionLine = false;
}
} else {
if (line.startsWith(GIT_AUTHOR)) {
author = line.substring(GIT_AUTHOR.length());
return;
}
if (line.startsWith(GIT_COMMITTER)) {
committer = line.substring(GIT_COMMITTER.length());
return;
}
if (line.startsWith(GIT_COMMITTER_TIME)) {
String timeStr = line.substring(GIT_COMMITTER_TIME.length());
time = new Date(Long.parseLong(timeStr) * 1000L);
return;
}
if (line.startsWith("\t")) {
// this is the content line.
// we actually don't need the content, but this is the right time to add the blame line
BlameLine blameLine = new BlameLine(time, revision, author, committer);
getLines().add(blameLine);
// keep commitinfo for this sha-1
commitInfo.put(revision, blameLine);
if (logger.isDebugEnabled()) {
DateFormat df = SimpleDateFormat.getDateTimeInstance();
logger.debug(author + " " + df.format(time));
}
expectRevisionLine = true;
}
}
}