Package org.apache.maven.scm.provider.jazz.command

Examples of org.apache.maven.scm.provider.jazz.command.JazzScmCommand


    // Create the JazzScmCommand to execute the "scm deliver ..." command
    // This will deliver the changes to the flow target (stream or other workspace).
    public JazzScmCommand createTagDeliverCommand( JazzScmProviderRepository repo, ScmFileSet fileSet, String tag )
    {
        JazzScmCommand command = new JazzScmCommand( JazzConstants.CMD_DELIVER, repo, fileSet, getLogger() );

        if ( repo.getWorkspace() != null && !repo.getWorkspace().equals( "" ) )
        {
            // Don't deliver from the workspace, as it has the release.properties etc files in it
            // and jazz will choke on them, so use the workspace that we just created (tag) instead.
            command.addArgument( JazzConstants.ARG_DELIVER_SOURCE );
            command.addArgument( tag );
        }

        if ( repo.getFlowTarget() != null && !repo.getFlowTarget().equals( "" ) )
        {
            command.addArgument( JazzConstants.ARG_DELIVER_TARGET );
            command.addArgument( repo.getFlowTarget() );
        }

        return command;
    }
View Full Code Here


        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 ( ScmFile file : statusScmFiles )
        {
            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

    // Create the JazzScmCommand to execute the "scm create workspace ..." command
    // This will create a workspace of the same name as the tag.
    public JazzScmCommand createTagCreateWorkspaceCommand( JazzScmProviderRepository repo, ScmFileSet fileSet,
                                                           String tag )
    {
        JazzScmCommand command =
            new JazzScmCommand( JazzConstants.CMD_CREATE, JazzConstants.CMD_SUB_WORKSPACE, repo, fileSet, getLogger() );

        if ( tag != null && !tag.trim().equals( "" ) )
        {
            command.addArgument( tag );
            command.addArgument( JazzConstants.ARG_WORKSPACE_SNAPSHOT );
            command.addArgument( tag );
        }

        return command;
    }
View Full Code Here

                                  patch.toString() );
    }

    public JazzScmCommand createDiffCommand( ScmProviderRepository repo, ScmFileSet fileSet, String relativePath )
    {
        JazzScmCommand command = new JazzScmCommand( JazzConstants.CMD_DIFF, repo, fileSet, getLogger() );
        command.addArgument( JazzConstants.ARG_FILE );
        command.addArgument( relativePath );
        return command;
    }
View Full Code Here

        }

        JazzStatusConsumer statusConsumer = new JazzStatusConsumer( repo, getLogger() );
        ErrorConsumer errConsumer = new ErrorConsumer( getLogger() );

        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() )
        {
            if ( !statusConsumer.getChangedFiles().isEmpty() )
            {
                getLogger().debug( "Iterating over \"Status\" results" );
                for ( ScmFile file : statusConsumer.getChangedFiles() )
                {
                    getLogger().debug( file.getPath() + " : " + file.getStatus() );
                }
            }
            else
            {
                getLogger().debug( "There are no differences" );
            }
        }

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

        return new StatusScmResult( statusCmd.getCommandString(), statusConsumer.getChangedFiles() );
    }

    public JazzScmCommand createStatusCommand( ScmProviderRepository repo, ScmFileSet fileSet )
    {
        JazzScmCommand command =
            new JazzScmCommand( JazzConstants.CMD_STATUS, null, repo, false, fileSet, getLogger() );

        command.addArgument( JazzConstants.ARG_STATUS_WIDE_PRINT_OUT );
        return command;
    }
View Full Code Here

        }

        DebugLoggerConsumer editConsumer = new DebugLoggerConsumer( getLogger() );
        ErrorConsumer errConsumer = new ErrorConsumer( getLogger() );

        JazzScmCommand editCmd = createEditCommand( repo, fileSet );
        int status = editCmd.execute( editConsumer, errConsumer );

        if ( status != 0 || errConsumer.hasBeenFed() )
        {
            return new EditScmResult( editCmd.getCommandString(), "Error code for Jazz SCM edit command - " + status,
                                      errConsumer.getOutput(), false );
        }

        return new EditScmResult( editCmd.getCommandString(), "Successfully Completed.", editConsumer.getOutput(),
                                  true );
    }
View Full Code Here

        }

        JazzUpdateConsumer updateConsumer = new JazzUpdateConsumer( repo, getLogger() );
        ErrorConsumer err = new ErrorConsumer( getLogger() );

        JazzScmCommand updateCmd = createAcceptCommand( repo, fileSet );
        int status = updateCmd.execute( updateConsumer, err );

        if ( status != 0 || err.hasBeenFed() )
        {
            return new UpdateScmResult( updateCmd.getCommandString(),
                                        "Error code for Jazz SCM update command - " + status, err.getOutput(), false );
        }

        if ( getLogger().isDebugEnabled() )
        {
            if ( !updateConsumer.getUpdatedFiles().isEmpty() )
            {
                getLogger().debug( "Iterating over \"Update\" results" );
                for ( ScmFile file : updateConsumer.getUpdatedFiles() )
                {
                    getLogger().debug( file.getPath() + " : " + file.getStatus() );
                }
            }
            else
            {
                getLogger().debug( "There are no updated files" );
            }
        }

        // Now, just (re)load the workspace into the sand box.
        // We can use the checkout directory for this.
        return new UpdateScmResult( updateCmd.getCommandString(), updateConsumer.getUpdatedFiles() );
    }
View Full Code Here

        if ( getLogger().isDebugEnabled() )
        {
            getLogger().debug( "Executing blame command..." );
        }

        JazzScmCommand blameCmd = createBlameCommand( repo, fileSet, filename );

        JazzBlameConsumer blameConsumer = new JazzBlameConsumer( repo, getLogger() );
        ErrorConsumer errConsumer = new ErrorConsumer( getLogger() );

        int status = blameCmd.execute( blameConsumer, errConsumer );
        if ( status != 0 || errConsumer.hasBeenFed() )
        {
            return new BlameScmResult( blameCmd.getCommandString(), "Error code for Jazz SCM blame command - " + status,
                                       errConsumer.getOutput(), false );
        }

        return new BlameScmResult( blameCmd.getCommandString(), blameConsumer.getLines() );
    }
View Full Code Here

        }

        DebugLoggerConsumer uneditConsumer = new DebugLoggerConsumer( getLogger() );
        ErrorConsumer errConsumer = new ErrorConsumer( getLogger() );

        JazzScmCommand uneditCmd = createUneditCommand( repo, fileSet );
        int status = uneditCmd.execute( uneditConsumer, errConsumer );

        if ( status != 0 || errConsumer.hasBeenFed() )
        {
            return new UnEditScmResult( uneditCmd.getCommandString(),
                                        "Error code for Jazz SCM unedit command - " + status, errConsumer.getOutput(),
                                        false );
        }

        return new UnEditScmResult( uneditCmd.getCommandString(), "Successfully Completed.", uneditConsumer.getOutput(),
                                    true );
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.scm.provider.jazz.command.JazzScmCommand

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.