Examples of CvsDiffConsumer


Examples of org.apache.maven.scm.provider.cvslib.command.diff.CvsDiffConsumer

    protected DiffScmResult executeCvsCommand( Commandline cl )
        throws ScmException
    {
        CvsLogListener logListener = new CvsLogListener();

        CvsDiffConsumer consumer = new CvsDiffConsumer( getLogger(), cl.getWorkingDirectory() );

        try
        {
            boolean isSuccess = CvsConnection.processCommand( cl.getArguments(),
                                                              cl.getWorkingDirectory().getAbsolutePath(), logListener,
                                                              getLogger() );

            if ( !isSuccess )
            {
                return new DiffScmResult( 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 )
        {
            e.printStackTrace();
            return new DiffScmResult( cl.toString(), "The cvs command failed.", logListener.getStdout().toString(),
                                      false );
        }

        return new DiffScmResult( cl.toString(), consumer.getChangedFiles(), consumer.getDifferences(),
                                  consumer.getPatch() );
    }
View Full Code Here

Examples of org.apache.maven.scm.provider.cvslib.command.diff.CvsDiffConsumer

{
    /** {@inheritDoc} */
    protected DiffScmResult executeCvsCommand( Commandline cl )
        throws ScmException
    {
        CvsDiffConsumer consumer = new CvsDiffConsumer( getLogger(), cl.getWorkingDirectory() );

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


        try
        {
            CommandLineUtils.executeCommandLine( cl, consumer, stderr );
        }
        catch ( CommandLineException ex )
        {
            throw new ScmException( "Error while executing command.", ex );
        }

// TODO: a difference returns a code of "1", as does errors. How to tell the difference?
//        if ( exitCode != 0 )
//        {
//            return new DiffScmResult( cl.toString(), "The cvs command failed.", stderr.getOutput(), false );
//        }

        return new DiffScmResult( cl.toString(), consumer.getChangedFiles(), consumer.getDifferences(),
                                  consumer.getPatch() );

    }
View Full Code Here

Examples of org.apache.maven.scm.provider.cvslib.command.diff.CvsDiffConsumer

    protected DiffScmResult executeCvsCommand( Commandline cl )
        throws ScmException
    {
        CvsLogListener logListener = new CvsLogListener();

        CvsDiffConsumer consumer = new CvsDiffConsumer( getLogger(), cl.getWorkingDirectory() );

        try
        {
            boolean isSuccess = CvsConnection.processCommand( cl.getArguments(),
                                                              cl.getWorkingDirectory().getAbsolutePath(), logListener,
                                                              getLogger() );

            if ( !isSuccess )
            {
                return new DiffScmResult( 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 )
        {
            e.printStackTrace();
            return new DiffScmResult( cl.toString(), "The cvs command failed.", logListener.getStdout().toString(),
                                      false );
        }

        return new DiffScmResult( cl.toString(), consumer.getChangedFiles(), consumer.getDifferences(),
                                  consumer.getPatch() );
    }
View Full Code Here

Examples of org.apache.maven.scm.provider.cvslib.command.diff.CvsDiffConsumer

{
    /** {@inheritDoc} */
    protected DiffScmResult executeCvsCommand( Commandline cl )
        throws ScmException
    {
        CvsDiffConsumer consumer = new CvsDiffConsumer( getLogger(), cl.getWorkingDirectory() );

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


        try
        {
            CommandLineUtils.executeCommandLine( cl, consumer, stderr );
        }
        catch ( CommandLineException ex )
        {
            throw new ScmException( "Error while executing command.", ex );
        }

// TODO: a difference returns a code of "1", as does errors. How to tell the difference?
//        if ( exitCode != 0 )
//        {
//            return new DiffScmResult( cl.toString(), "The cvs command failed.", stderr.getOutput(), false );
//        }

        return new DiffScmResult( cl.toString(), consumer.getChangedFiles(), consumer.getDifferences(),
                                  consumer.getPatch() );

    }
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.