use of org.apache.maven.scm.command.blame.BlameLine in project maven-scm by apache.
the class TfsBlameConsumer method consumeLine.
public void consumeLine(String line) {
Matcher matcher = LINE_PATTERN.matcher(line);
if (matcher.find()) {
String revision = matcher.group(1).trim();
String author = matcher.group(2).trim();
String dateStr = matcher.group(3).trim();
Date date = parseDate(dateStr, null, TFS_TIMESTAMP_PATTERN);
lines.add(new BlameLine(date, revision, author));
}
}
use of org.apache.maven.scm.command.blame.BlameLine in project maven-scm by apache.
the class TfsBlameConsumerTest method testConsumer.
public void testConsumer() throws Exception {
File testFile = getTestFile("src/test/resources/tfs/annotatelog.txt");
TfsBlameConsumer consumer = new TfsBlameConsumer(new DefaultLog());
FileInputStream fis = new FileInputStream(testFile);
BufferedReader in = new BufferedReader(new InputStreamReader(fis));
String s = in.readLine();
while (s != null) {
consumer.consumeLine(s);
s = in.readLine();
}
Assert.assertEquals(3, consumer.getLines().size());
BlameLine line1 = (BlameLine) consumer.getLines().get(0);
Assert.assertEquals("3", line1.getRevision());
Assert.assertEquals("hatusr01", line1.getAuthor());
BlameLine line2 = (BlameLine) consumer.getLines().get(1);
Assert.assertEquals("4", line2.getRevision());
Assert.assertEquals("buckh", line2.getAuthor());
}
use of org.apache.maven.scm.command.blame.BlameLine in project maven-scm by apache.
the class JazzBlameConsumer method consumeLine.
/**
* Process one line of output from the execution of the "scm annotate" command.
*
* @param line The line of output from the external command that has been pumped to us.
* @see org.codehaus.plexus.util.cli.StreamConsumer#consumeLine(java.lang.String)
*/
public void consumeLine(String line) {
super.consumeLine(line);
Matcher matcher = LINE_PATTERN.matcher(line);
if (matcher.matches()) {
String lineNumberStr = matcher.group(1);
String owner = matcher.group(2);
String changeSetNumberStr = matcher.group(3);
String dateStr = matcher.group(4);
Date date = parseDate(dateStr, JAZZ_TIMESTAMP_PATTERN, null);
fLines.add(new BlameLine(date, changeSetNumberStr, owner));
}
}
use of org.apache.maven.scm.command.blame.BlameLine in project maven-scm by apache.
the class JazzBlameCommandTckTest method verifyResult.
/**
* {@inheritDoc}
*
* @see org.apache.maven.scm.tck.command.blame.BlameCommandTckTest#verifyResult(org.apache.maven.scm.command.blame.BlameScmResult)
*/
@Override
protected void verifyResult(BlameScmResult result) {
List<BlameLine> lines = result.getLines();
assertEquals("Expected 1 line in blame!", 1, lines.size());
BlameLine line = lines.get(0);
assertNotSame("The revision can not be zero!", "0", line.getRevision());
}
use of org.apache.maven.scm.command.blame.BlameLine in project maven-scm by apache.
the class SvnBlameCommandTckTest method verifyResult.
protected void verifyResult(BlameScmResult result) {
List<BlameLine> lines = result.getLines();
assertEquals("Expected 1 line in blame", 1, lines.size());
BlameLine line = lines.get(0);
assertEquals("trygvis", line.getAuthor());
assertEquals("7", line.getRevision());
}
Aggregations