Search in sources :

Example 16 with BlameLine

use of org.apache.maven.scm.command.blame.BlameLine in project maven-scm by apache.

the class BazaarBlameConsumer method doConsume.

public void doConsume(ScmFileStatus status, String trimmedLine) {
    /*1   godin@godin 20100131*/
    String annotation = trimmedLine.substring(0, trimmedLine.indexOf('|')).trim();
    String dateStr = annotation.substring(annotation.lastIndexOf(' ') + 1);
    annotation = annotation.substring(0, annotation.lastIndexOf(' '));
    String author = annotation.substring(annotation.lastIndexOf(' ') + 1);
    annotation = annotation.substring(0, annotation.lastIndexOf(' '));
    String revision = annotation.trim();
    Date date = parseDate(dateStr, null, BAZAAR_TIMESTAMP_PATTERN);
    lines.add(new BlameLine(date, revision, author));
}
Also used : BlameLine(org.apache.maven.scm.command.blame.BlameLine) Date(java.util.Date)

Example 17 with BlameLine

use of org.apache.maven.scm.command.blame.BlameLine in project maven-scm by apache.

the class ClearCaseBlameConsumer method consumeLine.

public void consumeLine(String line) {
    Matcher matcher = LINE_PATTERN.matcher(line);
    if (matcher.matches()) {
        String revision = matcher.group(1);
        // SCM-613
        String author = matcher.group(2).toLowerCase();
        String dateTimeStr = matcher.group(3);
        Date dateTime = parseDate(dateTimeStr, null, CLEARCASE_TIMESTAMP_PATTERN);
        lines.add(new BlameLine(dateTime, revision, author));
        if (getLogger().isDebugEnabled()) {
            getLogger().debug(author + " " + dateTimeStr);
        }
    }
}
Also used : BlameLine(org.apache.maven.scm.command.blame.BlameLine) Matcher(java.util.regex.Matcher) Date(java.util.Date)

Example 18 with BlameLine

use of org.apache.maven.scm.command.blame.BlameLine in project maven-scm by apache.

the class HgBlameConsumer method doConsume.

public void doConsume(ScmFileStatus status, String trimmedLine) {
    /* godin 0 Sun Jan 31 03:04:54 2010 +0300 */
    String annotation;
    if (trimmedLine.indexOf(": ") > -1) {
        annotation = trimmedLine.substring(0, trimmedLine.indexOf(": ")).trim();
    } else {
        annotation = trimmedLine.substring(0, trimmedLine.lastIndexOf(":")).trim();
    }
    String author = annotation.substring(0, annotation.indexOf(' '));
    annotation = annotation.substring(annotation.indexOf(' ') + 1).trim();
    String revision = annotation.substring(0, annotation.indexOf(' '));
    annotation = annotation.substring(annotation.indexOf(' ') + 1).trim();
    String dateStr = annotation;
    Date dateTime = parseDate(dateStr, null, HG_TIMESTAMP_PATTERN, Locale.ENGLISH);
    lines.add(new BlameLine(dateTime, revision, author));
}
Also used : BlameLine(org.apache.maven.scm.command.blame.BlameLine) Date(java.util.Date)

Example 19 with BlameLine

use of org.apache.maven.scm.command.blame.BlameLine in project maven-scm by apache.

the class ClearCaseBlameConsumerTest method testConsumer.

public void testConsumer() throws IOException {
    InputStream inputStream = getResourceAsStream("/clearcase/blame/clearcase.log");
    BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
    String s = in.readLine();
    ClearCaseBlameConsumer consumer = new ClearCaseBlameConsumer(new DefaultLog());
    while (s != null) {
        consumer.consumeLine(s);
        s = in.readLine();
    }
    Assert.assertEquals(12, consumer.getLines().size());
    BlameLine line1 = (BlameLine) consumer.getLines().get(0);
    Assert.assertEquals("7", line1.getRevision());
    Assert.assertEquals("jeremie lagarde", line1.getAuthor());
    BlameLine line12 = (BlameLine) consumer.getLines().get(11);
    Assert.assertEquals("5", line12.getRevision());
    Assert.assertEquals("evgeny mandrikov", line12.getAuthor());
}
Also used : BlameLine(org.apache.maven.scm.command.blame.BlameLine) InputStreamReader(java.io.InputStreamReader) InputStream(java.io.InputStream) DefaultLog(org.apache.maven.scm.log.DefaultLog) BufferedReader(java.io.BufferedReader)

Example 20 with BlameLine

use of org.apache.maven.scm.command.blame.BlameLine in project maven-scm by apache.

the class HgBlameCommandTckTest 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("0", line.getRevision());
}
Also used : BlameLine(org.apache.maven.scm.command.blame.BlameLine)

Aggregations

BlameLine (org.apache.maven.scm.command.blame.BlameLine)29 Date (java.util.Date)11 Matcher (java.util.regex.Matcher)7 File (java.io.File)5 BlameScmResult (org.apache.maven.scm.command.blame.BlameScmResult)5 DefaultLog (org.apache.maven.scm.log.DefaultLog)4 BufferedReader (java.io.BufferedReader)3 InputStreamReader (java.io.InputStreamReader)2 SimpleDateFormat (java.text.SimpleDateFormat)2 ArrayList (java.util.ArrayList)2 ScmException (org.apache.maven.scm.ScmException)2 ScmFileSet (org.apache.maven.scm.ScmFileSet)2 Test (org.junit.Test)2 FileInputStream (java.io.FileInputStream)1 FileReader (java.io.FileReader)1 InputStream (java.io.InputStream)1 DateFormat (java.text.DateFormat)1 CommandParameters (org.apache.maven.scm.CommandParameters)1 BlameScmRequest (org.apache.maven.scm.command.blame.BlameScmRequest)1 CheckInScmResult (org.apache.maven.scm.command.checkin.CheckInScmResult)1