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 ===
        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
        this.edit( getWorkingCopy(), "readme.txt", null, getScmRepository() );
        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

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

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

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

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

            List<BlameLine> lines = new ArrayList<BlameLine>();

            int i = 0;
            while ( ( i = blameResult.computeNext() ) != -1 )
            {
                lines.add( new BlameLine( blameResult.getSourceAuthor( i ).getWhen(),
                                          blameResult.getSourceCommit( i ).getName(),
                                          blameResult.getSourceAuthor( i ).getName(),
                                          blameResult.getSourceCommitter( i ).getName() ) );
            }
View Full Code Here

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

        else if ( ( matcher = DATE_PATTERN.matcher( line ) ).find() )
        {
            String date = matcher.group( 1 );
            String time = matcher.group( 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 revision = matcher.group( 1 ).trim();
                String author = matcher.group( 2 ).trim();
                String dateTimeStr = matcher.group( 3 ).trim();

                Date dateTime = parseDate( dateTimeStr, null, CVS_TIMESTAMP_PATTERN, Locale.US );
                lines.add( new BlameLine( dateTime, revision, author ) );

                if ( getLogger().isDebugEnabled() )
                {
                    getLogger().debug( author + " " + dateTimeStr );
                }
View Full Code Here

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

            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 ) );
        }
    }
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

                String revision = matcher.group( 1 ).trim();
                String author = matcher.group( 2 ).trim();
                String dateTimeStr = matcher.group( 3 ).trim();

                Date dateTime = parseDate( dateTimeStr, null, CVS_TIMESTAMP_PATTERN, Locale.US );
                lines.add( new BlameLine( dateTime, revision, author ) );

                if ( getLogger().isDebugEnabled() )
                {
                    getLogger().debug( author + " " + dateTimeStr );
                }
View Full Code Here

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

            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 );

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.