Package org.apache.maven.scm.provider.git.command.diff

Examples of org.apache.maven.scm.provider.git.command.diff.GitDiffConsumer


    /** {@inheritDoc} */
    protected DiffScmResult executeDiffCommand( ScmProviderRepository repo, ScmFileSet fileSet,
                                                ScmVersion startVersion, ScmVersion endVersion )
        throws ScmException
    {
        GitDiffConsumer consumer = new GitDiffConsumer( getLogger(), fileSet.getBasedir() );
        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
        int exitCode;

        Commandline clDiff2Index = createCommandLine( fileSet.getBasedir(), startVersion, endVersion, false );

        exitCode = GitCommandLineUtils.execute( clDiff2Index, consumer, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            return new DiffScmResult( clDiff2Index.toString(), "The git-diff command failed.", stderr.getOutput(),
                                      false );
        }

        Commandline clDiff2Head = createCommandLine( fileSet.getBasedir(), startVersion, endVersion, true );

        exitCode = GitCommandLineUtils.execute( clDiff2Head, consumer, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            return new DiffScmResult( clDiff2Head.toString(), "The git-diff command failed.", stderr.getOutput(), false );
        }

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


    /** {@inheritDoc} */
    protected DiffScmResult executeDiffCommand( ScmProviderRepository repo, ScmFileSet fileSet,
                                                ScmVersion startVersion, ScmVersion endVersion )
        throws ScmException
    {
        GitDiffConsumer consumer = new GitDiffConsumer( getLogger(), fileSet.getBasedir() );
        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
        int exitCode;

        Commandline clDiff2Index = createCommandLine( fileSet.getBasedir(), startVersion, endVersion, false );

        exitCode = GitCommandLineUtils.execute( clDiff2Index, consumer, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            return new DiffScmResult( clDiff2Index.toString(), "The git-diff command failed.", stderr.getOutput(),
                                      false );
        }

        Commandline clDiff2Head = createCommandLine( fileSet.getBasedir(), startVersion, endVersion, true );

        exitCode = GitCommandLineUtils.execute( clDiff2Head, consumer, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            return new DiffScmResult( clDiff2Head.toString(), "The git-diff command failed.", stderr.getOutput(), false );
        }

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

        git.diff().setOutputStream( out ).setOldTree( oldTree ).setNewTree( newTree ).setCached( false ).call();
        git.diff().setOutputStream( out ).setOldTree( oldTree ).setNewTree( newTree ).setCached( true ).call();

        out.flush();

        GitDiffConsumer consumer = new GitDiffConsumer( getLogger(), null );
        String fullDiff = out.toString();
        out.close();

        String[] lines = fullDiff.split( "\n" );
        for ( String aLine : lines )
        {
            consumer.consumeLine( aLine );
        }

        return new DiffScmResult( "JGit diff", consumer.getChangedFiles(), consumer.getDifferences(),
                                  consumer.getPatch() );
    }
View Full Code Here

    /** {@inheritDoc} */
    protected DiffScmResult executeDiffCommand( ScmProviderRepository repo, ScmFileSet fileSet,
                                                ScmVersion startVersion, ScmVersion endVersion )
        throws ScmException
    {
        GitDiffConsumer consumer = new GitDiffConsumer( getLogger(), fileSet.getBasedir() );
        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
        int exitCode;

        Commandline clDiff2Index = createCommandLine( fileSet.getBasedir(), startVersion, endVersion, false );

        exitCode = GitCommandLineUtils.execute( clDiff2Index, consumer, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            return new DiffScmResult( clDiff2Index.toString(), "The git-diff command failed.", stderr.getOutput(),
                                      false );
        }

        Commandline clDiff2Head = createCommandLine( fileSet.getBasedir(), startVersion, endVersion, true );

        exitCode = GitCommandLineUtils.execute( clDiff2Head, consumer, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            return new DiffScmResult( clDiff2Head.toString(), "The git-diff command failed.", stderr.getOutput(),
                                      false );
        }

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

    /** {@inheritDoc} */
    protected DiffScmResult executeDiffCommand( ScmProviderRepository repo, ScmFileSet fileSet,
                                                ScmVersion startVersion, ScmVersion endVersion )
        throws ScmException
    {
        GitDiffConsumer consumer = new GitDiffConsumer( getLogger(), fileSet.getBasedir() );
        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
        int exitCode;

        Commandline clDiff2Index = createCommandLine( fileSet.getBasedir(), startVersion, endVersion, false );

        exitCode = GitCommandLineUtils.execute( clDiff2Index, consumer, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            return new DiffScmResult( clDiff2Index.toString(), "The git-diff command failed.", stderr.getOutput(),
                                      false );
        }

        Commandline clDiff2Head = createCommandLine( fileSet.getBasedir(), startVersion, endVersion, true );

        exitCode = GitCommandLineUtils.execute( clDiff2Head, consumer, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            return new DiffScmResult( clDiff2Head.toString(), "The git-diff command failed.", stderr.getOutput(), false );
        }

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

TOP

Related Classes of org.apache.maven.scm.provider.git.command.diff.GitDiffConsumer

Copyright © 2018 www.massapicom. 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.