Examples of DiffScmResult


Examples of org.apache.maven.scm.command.diff.DiffScmResult

        setAddScmResult( new AddScmResult( "", Collections.<ScmFile>emptyList() ) );
        setBranchScmResult( new BranchScmResult( "", Collections.<ScmFile>emptyList() ) );
        setChangeLogScmResult( new ChangeLogScmResult( "", "", "", true ) );
        setCheckInScmResult( new CheckInScmResult( "", "", "", true ) );
        setCheckOutScmResult( new CheckOutScmResult( "", "", "", true ) );
        setDiffScmResult( new DiffScmResult( "", "", "", true ) );
        setEditScmResult( new EditScmResult( "", "", "", true ) );
        setExportScmResult( new ExportScmResult( "", "", "", true ) );
        setRemoveScmResult( new RemoveScmResult( "", "", "", true ) );
        setStatusScmResult( new StatusScmResult( "", "", "", true ) );
        setTagScmResult( new TagScmResult( "", "", "", true ) );
View Full Code Here

Examples of org.apache.maven.scm.command.diff.DiffScmResult

                diffCmd = createDiffCommand( repo, fileSet, relativePath );
                int status = diffCmd.execute( diffConsumer, errConsumer );
                if ( status != 0 || errConsumer.hasBeenFed() )
                {
                    // Return a false result (not the usual SCMResult)
                    return new DiffScmResult( diffCmd.toString(), "The scm diff command failed.",
                                              errConsumer.getOutput(), false );
                }
                // Append to patch (all combined)
                patch.append( diffConsumer.getOutput() );
                // Set the differences map <File, <CharSequence>
                differences.put( relativePath, diffConsumer.getOutput() );
            }
        }

        return new DiffScmResult( diffCmd.toString(), statusCmdResult.getChangedFiles(), differences,
                                  patch.toString() );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.diff.DiffScmResult

            {
                getLogger().error( "CommandLineException " + e.getMessage(), e );
            }
        }

        return new DiffScmResult( cl.toString(), success ? "Diff successful" : "Unable to diff", consumer
            .getOutput(), success );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.diff.DiffScmResult

        try
        {
            ScmRepository repository = getScmRepository();

            DiffScmResult result = getScmManager().diff( repository, getFileSet(),
                                                         getScmVersion( startScmVersionType, startScmVersion ),
                                                         getScmVersion( endScmVersionType, endScmVersion ) );

            checkResult( result );

            getLog().info( result.getPatch() );

            try
            {
                if ( outputFile != null )
                {
                    FileUtils.fileWrite( outputFile.getAbsolutePath(), result.getPatch() );
                }
            }
            catch ( IOException e )
            {
                throw new MojoExecutionException( "Can't write patch file.", e );
View Full Code Here

Examples of org.apache.maven.scm.command.diff.DiffScmResult

        setAddScmResult( new AddScmResult( "", Collections.<ScmFile>emptyList() ) );
        setBranchScmResult( new BranchScmResult( "", Collections.<ScmFile>emptyList() ) );
        setChangeLogScmResult( new ChangeLogScmResult( "", "", "", true ) );
        setCheckInScmResult( new CheckInScmResult( "", "", "", true ) );
        setCheckOutScmResult( new CheckOutScmResult( "", "", "", true ) );
        setDiffScmResult( new DiffScmResult( "", "", "", true ) );
        setEditScmResult( new EditScmResult( "", "", "", true ) );
        setExportScmResult( new ExportScmResult( "", "", "", true ) );
        setRemoveScmResult( new RemoveScmResult( "", "", "", true ) );
        setStatusScmResult( new StatusScmResult( "", "", "", true ) );
        setTagScmResult( new TagScmResult( "", "", "", true ) );
View Full Code Here

Examples of org.apache.maven.scm.command.diff.DiffScmResult

        // Diff the project
        // ----------------------------------------------------------------------

        ScmProvider provider = getScmManager().getProviderByUrl( getScmUrl() );
        ScmFileSet fileSet = new ScmFileSet( getWorkingCopy() );
        DiffScmResult result = provider.diff( repository, fileSet, null, (ScmVersion) null );

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

        assertResultIsSuccess( result );

        List<ScmFile> changedFiles = result.getChangedFiles();

        Map<String, CharSequence> differences = result.getDifferences();

        assertEquals( "Expected 3 files in the changed files list " + changedFiles, 3, changedFiles.size() );

        assertEquals( "Expected 3 files in the differences list " + differences, 3, differences.size() );
View Full Code Here

Examples of org.apache.maven.scm.command.diff.DiffScmResult

        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

Examples of org.apache.maven.scm.command.diff.DiffScmResult

    @Override
    public DiffScmResult executeDiffCommand( ScmProviderRepository repository, ScmFileSet fileSet,
                                             ScmVersion startRevision, ScmVersion endRevision )
        throws ScmException
    {
        DiffScmResult result;
        IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
        APISession api = iRepo.getAPISession();
        getLogger().info( "Showing differences bettween local files in " + fileSet.getBasedir().getAbsolutePath()
                              + " and server project " + iRepo.getConfigruationPath() );

        // Since the si diff command is not completely API ready, we will use the CLI for this command
        Commandline shell = new Commandline();
        shell.setWorkingDirectory( fileSet.getBasedir() );
        shell.setExecutable( "si" );
        shell.createArg().setValue( "diff" );
        shell.createArg().setValue( "--hostname=" + api.getHostName() );
        shell.createArg().setValue( "--port=" + api.getPort() );
        shell.createArg().setValue( "--user=" + api.getUserName() );
        shell.createArg().setValue( "-R" );
        shell.createArg().setValue( "--filter=changed:all" );
        shell.createArg().setValue( "--filter=format:text" );
        IntegrityDiffConsumer shellConsumer = new IntegrityDiffConsumer( getLogger() );

        try
        {
            getLogger().debug( "Executing: " + shell.getCommandline() );
            int exitCode = CommandLineUtils.executeCommandLine( shell, shellConsumer,
                                                                new CommandLineUtils.StringStreamConsumer() );
            boolean success = ( exitCode == 128 ? false : true );
            ScmResult scmResult =
                new ScmResult( shell.getCommandline().toString(), "", "Exit Code: " + exitCode, success );
            // Since we can't really parse the differences output, we'll just have to go by the command output
            // Returning a DiffScmResult(List changedFiles, Map differences, String patch, ScmResult result) to avoid an NPE
            // in org.codehaus.plexus.util.FileUtils.fileWrite(FileUtils.java:426)
            return new DiffScmResult( new ArrayList<ScmFile>(), new HashMap<String, CharSequence>(), "", scmResult );

        }
        catch ( CommandLineException cle )
        {
            getLogger().error( "Command Line Exception: " + cle.getMessage() );
            result = new DiffScmResult( shell.getCommandline().toString(), cle.getMessage(), "", false );
        }

        return result;
    }
View Full Code Here

Examples of org.apache.maven.scm.command.diff.DiffScmResult

        diffCmd = HgUtils.expandCommandLine( diffCmd, fileSet );
        HgDiffConsumer consumer = new HgDiffConsumer( getLogger(), fileSet.getBasedir() );

        ScmResult result = HgUtils.execute( consumer, getLogger(), fileSet.getBasedir(), diffCmd );

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

Examples of org.apache.maven.scm.command.diff.DiffScmResult

        // Diff the project
        // ----------------------------------------------------------------------

        ScmProvider provider = getScmManager().getProviderByUrl( getScmUrl() );
        ScmFileSet fileSet = new ScmFileSet( getWorkingCopy() );
        DiffScmResult result = provider.diff( repository, fileSet, null, (ScmVersion) null );

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

        assertResultIsSuccess( result );

        List<ScmFile> changedFiles = result.getChangedFiles();

        Map<String, CharSequence> differences = result.getDifferences();

        assertEquals( "Expected 3 files in the changed files list " + changedFiles, 3, changedFiles.size() );

        assertEquals( "Expected 3 files in the differences list " + differences, 3, differences.size() );
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.