Examples of BlameLine


Examples of org.apache.maven.scm.command.blame.BlameLine

        ScmManager manager = getScmManager();
        ScmProvider provider = manager.getProviderByRepository( getScmRepository() );
        ScmFileSet fileSet = new ScmFileSet( getWorkingCopy() );

        BlameScmResult result;
        BlameLine line;

        // === readme.txt ===
        result = manager.blame( repository, fileSet, "readme.txt" );
        assertNotNull( "The command returned a null result.", result );
        assertResultIsSuccess( result );
        assertEquals( "Expected 1 line in blame", 1, result.getLines().size() );
        line = result.getLines().get( 0 );
        String initialRevision = line.getRevision();

        //Make a timestamp that we know are after initial revision but before the second
        Date timeBeforeSecond = new Date(); // Current time
        // pause a couple seconds...
        Thread.sleep( 2000 );
        //Make a change to the readme.txt and commit the change
        ScmTestCase.makeFile( getWorkingCopy(), "/readme.txt", "changed readme.txt" );
        CheckInScmResult checkInResult = provider.checkIn( getScmRepository(), fileSet, COMMIT_MSG );
        assertTrue( "Unable to checkin changes to the repository", checkInResult.isSuccess() );

        result = manager.blame( repository, fileSet, "readme.txt" );

        // pause a couple seconds...
        Thread.sleep( 2000 );
        Date timeAfterSecond = new Date(); // Current time

        assertNotNull( "The command returned a null result.", result );
        assertResultIsSuccess( result );

        assertEquals( "Expected 1 line in blame", 1, result.getLines().size() );
        line = result.getLines().get( 0 );

        assertNotNull( "Expected not null author", line.getAuthor() );
        assertNotNull( "Expected not null revision", line.getRevision() );
        assertNotNull( "Expected not null date", line.getDate() );

        assertTrue( "Expected another revision", !initialRevision.equals( line.getRevision() ) );
        if ( isTestDateTime() )
        {
            assertDateBetween( timeBeforeSecond, timeAfterSecond, line.getDate() );
        }

        // === pom.xml ===
        result = manager.blame( repository, fileSet, "pom.xml" );
View Full Code Here

Examples of org.apache.maven.scm.command.blame.BlameLine

            }
            else
            {
                try
                {
                    blameList.add( new BlameLine( dateFormat.parse( tokens[0] ), tokens[1], tokens[2] ) );
                }
                catch ( ParseException e )
                {
                    logger.error( "Failed to date string: " + tokens[0] );
                }
View Full Code Here

Examples of org.apache.maven.scm.command.blame.BlameLine

        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 ) );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.blame.BlameLine

        ScmManager manager = getScmManager();
        ScmProvider provider = manager.getProviderByRepository( getScmRepository() );
        ScmFileSet fileSet = new ScmFileSet( getWorkingCopy() );

        BlameScmResult result;
        BlameLine line;

        // === readme.txt ===
        BlameScmRequest blameScmRequest = new BlameScmRequest( repository, fileSet );
        blameScmRequest.setFilename( "readme.txt" );
        //result = manager.blame( repository, fileSet, "readme.txt" );
        result = manager.blame( blameScmRequest );
        assertNotNull( "The command returned a null result.", result );
        assertResultIsSuccess( result );
        assertEquals( "Expected 1 line in blame", 1, result.getLines().size() );
        line = result.getLines().get( 0 );
        String initialRevision = line.getRevision();

        //Make a timestamp that we know are after initial revision but before the second
        Date timeBeforeSecond = new Date(); // Current time
        // pause a couple seconds...
        Thread.sleep( 2000 );
        //Make a change to the readme.txt and commit the change
        ScmTestCase.makeFile( getWorkingCopy(), "/readme.txt", "changed readme.txt" );
        CheckInScmResult checkInResult = provider.checkIn( getScmRepository(), fileSet, COMMIT_MSG );
        assertTrue( "Unable to checkin changes to the repository", checkInResult.isSuccess() );

        result = manager.blame( repository, fileSet, "readme.txt" );

        // pause a couple seconds...
        Thread.sleep( 2000 );
        Date timeAfterSecond = new Date(); // Current time

        assertNotNull( "The command returned a null result.", result );
        assertResultIsSuccess( result );

        assertEquals( "Expected 1 line in blame", 1, result.getLines().size() );
        line = result.getLines().get( 0 );

        assertNotNull( "Expected not null author", line.getAuthor() );
        assertNotNull( "Expected not null revision", line.getRevision() );
        assertNotNull( "Expected not null date", line.getDate() );

        assertTrue( "Expected another revision", !initialRevision.equals( line.getRevision() ) );
        if ( isTestDateTime() )
        {
            assertDateBetween( timeBeforeSecond, timeAfterSecond, line.getDate() );
        }

        // === pom.xml ===
        result = manager.blame( repository, fileSet, "pom.xml" );
View Full Code Here

Examples of org.apache.maven.scm.command.blame.BlameLine

        else if ( dateRegexp.match( line ) )
        {
            String date = dateRegexp.getParen( 1 );
            String time = dateRegexp.getParen( 2 );
            Date dateTime = parseDateTime( date + " " + time );
            lines.add( new BlameLine( dateTime, revision, author ) );
            if ( getLogger().isDebugEnabled() )
            {
                getLogger().debug( "Author of line " + lineNumber + ": " + author + " (" + date + ")" );
            }
        }
View Full Code Here

Examples of org.apache.maven.scm.command.blame.BlameLine

            String lineNumberStr = lineRegexp.getParen( 1 );
            String owner = lineRegexp.getParen( 2 );
            String changeSetNumberStr = lineRegexp.getParen( 3 );
            String dateStr = lineRegexp.getParen( 4 );
            Date date = parseDate( dateStr, JAZZ_TIMESTAMP_PATTERN, null );
            fLines.add( new BlameLine( date, changeSetNumberStr, owner ) );
        }
    }
View Full Code Here

Examples of org.apache.maven.scm.command.blame.BlameLine

    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( "Mark Struberg", line.getAuthor() );
        assertEquals( "92f139dfec4d1dfb79c3cd2f94e83bf13129668b", line.getRevision() );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.blame.BlameLine

    {
        GitBlameConsumer consumer = consumeFile( "/src/test/resources/git/blame/git-blame-3.out" );

        Assert.assertEquals( 36, consumer.getLines().size() );

        BlameLine blameLine = consumer.getLines().get( 11 );
        Assert.assertEquals( "e670863b2b03e158c59f34af1fee20f91b2bd852", blameLine.getRevision() );
        Assert.assertEquals( "Mark Struberg", blameLine.getAuthor() );
        Assert.assertNotNull( blameLine.getDate() );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.blame.BlameLine

    {
        GitBlameConsumer consumer = consumeFile( "/src/test/resources/git/blame/git-blame.out" );

        Assert.assertEquals( 187, consumer.getLines().size() );

        BlameLine blameLine = consumer.getLines().get( 11 );
        Assert.assertEquals( "e670863b2b03e158c59f34af1fee20f91b2bd852", blameLine.getRevision() );
        Assert.assertEquals( "Mark Struberg", blameLine.getAuthor() );
        Assert.assertNotNull( blameLine.getDate() );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.blame.BlameLine

        throws Exception
    {
        GitBlameConsumer consumer = consumeFile( "/src/test/resources/git/blame/git-blame-new-file.out" );

        Assert.assertEquals( 3, consumer.getLines().size() );
        BlameLine blameLine = consumer.getLines().get( 0 );
        Assert.assertNotNull( blameLine );
        Assert.assertEquals( "0000000000000000000000000000000000000000", blameLine.getRevision() );
        Assert.assertEquals( "Not Committed Yet", blameLine.getAuthor() );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.