Package org.apache.maven.scm.command.status

Examples of org.apache.maven.scm.command.status.StatusScmResult


        List<File> changedFiles = new ArrayList<File>();
        List<ScmFile> commitedFiles = new ArrayList<ScmFile>();

        JazzStatusCommand statusCmd = new JazzStatusCommand();
        statusCmd.setLogger( getLogger() );
        StatusScmResult statusCmdResult = statusCmd.executeStatusCommand( repo, fileSet );
        List<ScmFile> statusScmFiles = statusCmdResult.getChangedFiles();

        for ( Iterator<ScmFile> it = statusScmFiles.iterator(); it.hasNext(); )
        {
            ScmFile file = (ScmFile) it.next();
            getLogger().debug( "Iterating over statusScmFiles: " + file );
View Full Code Here


        // src/main/java/org/Foo.java is added
        // /pom.xml is modified
        // check that readme and project.xml are not updated/created
        // ----------------------------------------------------------------------

        StatusScmResult result = scmManager.getProviderByUrl( getScmUrl() )
            .status( repository, new ScmFileSet( getUpdatingCopy() ) );

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

        assertResultIsSuccess( result );

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

        assertEquals( "Expected 2 files in the updated files list " + changedFiles, 2, changedFiles.size() );

        // ----------------------------------------------------------------------
        // Assert the files in the updated files list
View Full Code Here

        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 ) );
        setUnEditScmResult( new UnEditScmResult( "", "", "", true ) );
        setUpdateScmResult( new UpdateScmResult( "", "", "", true ) );
        setBlameScmResult( new BlameScmResult( "", "", "", true ) );
        setMkdirScmResult( new MkdirScmResult( "", "", "", true ) );
View Full Code Here

        JazzScmCommand statusCmd = createStatusCommand( repo, fileSet );
        int status = statusCmd.execute( statusConsumer, errConsumer );
        if ( status != 0 || errConsumer.hasBeenFed() )
        {
            return new StatusScmResult( statusCmd.getCommandString(),
                                        "Error code for Jazz SCM status command - " + status, errConsumer.getOutput(),
                                        false );
        }

        if ( getLogger().isDebugEnabled() )
        {
            Iterator<ScmFile> iter = statusConsumer.getChangedFiles().iterator();
            if ( iter.hasNext() )
            {
                getLogger().debug( "Iterating over \"Status\" results" );
                while ( iter.hasNext() )
                {
                    ScmFile file = (ScmFile) iter.next();
                    getLogger().debug( file.getPath() + " : " + file.getStatus() );
                }
            }
            else
            {
                getLogger().debug( "There are no differences" );
            }
        }

        return new StatusScmResult( statusCmd.getCommandString(), statusConsumer.getChangedFiles() );
    }
View Full Code Here

        File parentFolder = ( baseDir.getParentFile() != null ) ? baseDir.getParentFile() : baseDir;

        // First execute the status command to get the list of changed files.
        JazzStatusCommand statusCmd = new JazzStatusCommand();
        statusCmd.setLogger( getLogger() );
        StatusScmResult statusCmdResult = statusCmd.executeStatusCommand( repo, fileSet );
        List<ScmFile> statusScmFiles = statusCmdResult.getChangedFiles();

        // In this case, we also use it across multiple calls to "scm diff" so that we
        // sum all output into on.
        JazzScmCommand diffCmd = null;
        StringBuilder patch = new StringBuilder();
        Map<String, CharSequence> differences = new HashMap<String, CharSequence>();

        // Now lets iterate through them
        for ( Iterator<ScmFile> it = statusScmFiles.iterator(); it.hasNext(); )
        {
            ScmFile file = (ScmFile) it.next();
            if ( file.getStatus() == ScmFileStatus.MODIFIED )
            {
                // The "scm status" command returns files relative to the sandbox root.
                // Whereas the "scm diff" command needs them relative to the working directory.
                File fullPath = new File( parentFolder, file.getPath() );
                String relativePath = fullPath.toString().substring( baseDir.toString().length() );
                getLogger().debug( "Full Path     : '" + fullPath + "'" );
                getLogger().debug( "Relative Path : '" + relativePath + "'" );

                // Now call "scm diff on it"
                // In this case, we use the DebugLoggerConsumer's ability to store captured output
                DebugLoggerConsumer diffConsumer = new DebugLoggerConsumer( getLogger() );
                ErrorConsumer errConsumer = new ErrorConsumer( getLogger() );
                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

        {
            ScmFile f = new ScmFile( filename, ScmFileStatus.MODIFIED );
            result.add( f );
        }

        return new StatusScmResult( "ccm dir", result );
    }
View Full Code Here

        Commandline command = readOpened( prepo, files, consumer );

        if ( consumer.isSuccess() )
        {
            List<ScmFile> scmfiles = createResults( actualLocation, consumer );
            return new StatusScmResult( command.toString(), scmfiles );
        }

        return new StatusScmResult( command.toString(), "Unable to get status", consumer
                .getOutput(), consumer.isSuccess() );
    }
View Full Code Here

        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 ) );
        setUnEditScmResult( new UnEditScmResult( "", "", "", true ) );
        setUpdateScmResult( new UpdateScmResult( "", "", "", true ) );
        setBlameScmResult( new BlameScmResult( "", "", "", true ) );
        setMkdirScmResult( new MkdirScmResult( "", "", "", true ) );
View Full Code Here

        // src/main/java/org/Foo.java is added
        // /pom.xml is modified
        // check that readme and project.xml are not updated/created
        // ----------------------------------------------------------------------

        StatusScmResult result = scmManager.getProviderByUrl( getScmUrl() )
            .status( repository, new ScmFileSet( getUpdatingCopy() ) );

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

        assertResultIsSuccess( result );

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

        assertEquals( "Expected 2 files in the updated files list " + changedFiles, 2, changedFiles.size() );

        // ----------------------------------------------------------------------
        // Assert the files in the updated files list
View Full Code Here

        List<ScmFile> scmFiles = new ArrayList<ScmFile>();
        for ( File file : fileSet.getFileList() )
        {
            scmFiles.add( new ScmFile( file.getPath(), ScmFileStatus.DELETED ) );
        }
        return new StatusScmResult( "", scmFiles );
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.scm.command.status.StatusScmResult

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.