Examples of BlameScmResult


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

            boolean isSuccess =
                CvsConnection.processCommand( cl.getArguments(), cl.getWorkingDirectory().getAbsolutePath(),
                                              logListener, getLogger() );
            if ( !isSuccess )
            {
                return new BlameScmResult( cl.toString(), "The cvs command failed.", logListener.getStderr().toString(),
                                           false );
            }
            BufferedReader stream = new BufferedReader(
                new InputStreamReader( new ByteArrayInputStream( logListener.getStdout().toString().getBytes() ) ) );
            String line;
            while ( ( line = stream.readLine() ) != null )
            {
                consumer.consumeLine( line );
            }
        }
        catch ( Exception e )
        {
            getLogger().error( e );
            return new BlameScmResult( cl.toString(), "The cvs command failed.", logListener.getStdout().toString(),
                                       false );
        }

        return new BlameScmResult( cl.toString(), consumer.getLines() );
    }
View Full Code Here

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

        AccuRevBlameCommand command = new AccuRevBlameCommand( getLogger() );

        CommandParameters commandParameters = new CommandParameters();
        commandParameters.setString( CommandParameter.FILE, file.getPath() );
        BlameScmResult result = command.blame( repo, testFileSet, commandParameters );

        assertThat( result.isSuccess(), is( true ) );
        assertThat( result.getLines().size(), is( 1 ) );
        assertThat( ( (BlameLine) result.getLines().get( 0 ) ), is( blameLine ) );

    }
View Full Code Here

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

        String[] cmd = new String[]{BLAME_CMD, "--all"// Show annotations on all lines
            "--long", // Show commit date in annotations
            filename};
        BazaarBlameConsumer consumer = new BazaarBlameConsumer( getLogger() );
        ScmResult result = BazaarUtils.execute( consumer, getLogger(), workingDirectory.getBasedir(), cmd );
        return new BlameScmResult( consumer.getLines(), result );
    }
View Full Code Here

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

        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();

        int exitCode = GitCommandLineUtils.execute( cl, consumer, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            return new BlameScmResult( cl.toString(), "The git blame command failed.", stderr.getOutput(), false );
        }
        return new BlameScmResult( cl.toString(), consumer.getLines() );
    }
View Full Code Here

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

        {
            throw new ScmException( "Error while executing command.", ex );
        }
        if ( exitCode != 0 )
        {
            return new BlameScmResult( cl.toString(), "The perforce command failed.", stderr.getOutput(), false );
        }

        // Call filelog command

        cl = createFilelogCommandLine( (PerforceScmProviderRepository) repo, workingDirectory.getBasedir(), filename, clientspec );

        PerforceFilelogConsumer filelogConsumer = new PerforceFilelogConsumer( getLogger() );

        try
        {
            exitCode = CommandLineUtils.executeCommandLine( cl, filelogConsumer, stderr );
        }
        catch ( CommandLineException ex )
        {
            throw new ScmException( "Error while executing command.", ex );
        }
        if ( exitCode != 0 )
        {
            return new BlameScmResult( cl.toString(), "The perforce command failed.", stderr.getOutput(), false );
        }

        // Combine results

        List<BlameLine> lines = blameConsumer.getLines();
        for ( int i = 0; i < lines.size(); i++ )
        {
            BlameLine line = lines.get( i );
            String revision = line.getRevision();
            line.setAuthor( filelogConsumer.getAuthor( revision ) );
            line.setDate( filelogConsumer.getDate( revision ) );
        }

        return new BlameScmResult( cl.toString(), lines );
    }
View Full Code Here

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

        {
            throw new ScmException( "Error while executing command.", ex );
        }
        if ( exitCode != 0 )
        {
            return new BlameScmResult( cl.toString(), "The tfs command failed.", stderr.getOutput(), false );
        }

        return new BlameScmResult( cl.toString(), consumer.getLines() );
    }
View Full Code Here

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

            throw new ScmException( "Error while executing cvs command.", ex );
        }

        if ( exitCode != 0 )
        {
            return new BlameScmResult( cl.toString(), "The cleartool command failed.", stderr.getOutput(), false );
        }

        return new BlameScmResult( cl.toString(), consumer.getLines() );
    }
View Full Code Here

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

        {
            throw new ScmException( "Error while executing cvs command.", ex );
        }
        if ( exitCode != 0 )
        {
            return new BlameScmResult( cl.toString(), "The cvs command failed.", stderr.getOutput(), false );
        }
        return new BlameScmResult( cl.toString(), consumer.getLines() );
    }
View Full Code Here

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

        ScmRepository repository = getScmRepository();
        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() );
View Full Code Here

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

                                          blameResult.getSourceCommit( i ).getName(),
                                          blameResult.getSourceAuthor( i ).getName(),
                                          blameResult.getSourceCommitter( i ).getName() ) );
            }

            return new BlameScmResult( "JGit blame", lines );
        }
        catch ( Exception e )
        {
            throw new ScmException( "JGit blame failure!", e );
        }
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.