Examples of JazzScmCommand


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

        return new AddScmResult( command.getCommandString(), addConsumer.getFiles() );
    }

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

        List<File> files = fileSet.getFileList();
        if ( files != null && !files.isEmpty() )
        {
            Iterator<File> it = files.iterator();
            while ( it.hasNext() )
            {
                File file = (File) it.next();
                command.addArgument( file.getPath() ); // Check in only the files specified
            }
        }
        else
        {
            command.addArgument( "." ); // This will check in all local changes
        }

        return command;
    }
View Full Code Here

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

        }

        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

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

                                    true );
    }

    public JazzScmCommand createUneditCommand( ScmProviderRepository repo, ScmFileSet fileSet )
    {
        JazzScmCommand command =
            new JazzScmCommand( JazzConstants.CMD_LOCK, JazzConstants.CMD_SUB_RELEASE, repo, fileSet, getLogger() );

        List<File> files = fileSet.getFileList();
        if ( files != null && !files.isEmpty() )
        {
            Iterator<File> it = files.iterator();
            while ( it.hasNext() )
            {
                File file = (File) it.next();
                command.addArgument( file.getPath() ); // Un-Lock only the files specified
            }
        }
        else
        {
            command.addArgument( "." ); // Un-Lock all files
        }

        return command;
    }
View Full Code Here

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

        }

        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() )
        {
            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

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

        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

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

        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

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

                                  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

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

        getLogger().debug( "Creating Snapshot..." );
        StreamConsumer tagConsumer =
            new DebugLoggerConsumer( getLogger() );      // No need for a dedicated consumer for this
        ErrorConsumer errConsumer = new ErrorConsumer( getLogger() );
        JazzScmCommand tagCreateSnapshotCmd =
            createTagCreateSnapshotCommand( jazzRepo, fileSet, tag, scmTagParameters );
        int status = tagCreateSnapshotCmd.execute( tagConsumer, errConsumer );

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

        // ------------------------------------------------------------------
        // We create the workspace based on the tag here, as the scm tool
        // can not currently check directly out from a snapshot (only a workspace).
        getLogger().debug( "Creating Workspace from Snapshot..." );
        JazzScmCommand tagCreateWorkspaceCmd = createTagCreateWorkspaceCommand( jazzRepo, fileSet, tag );
        errConsumer = new ErrorConsumer( getLogger() );
        status = tagCreateWorkspaceCmd.execute( tagConsumer, errConsumer );

        if ( status != 0 || errConsumer.hasBeenFed() )
        {
            return new TagScmResult( tagCreateWorkspaceCmd.getCommandString(),
                                     "Error code for Jazz SCM tag (WORKSPACE) command - " + status,
                                     errConsumer.getOutput(), false );
        }
        // ------------------------------------------------------------------

        if ( jazzRepo.isPushChangesAndHaveFlowTargets() )
        {
            // isPushChanges = true, and we have something to deliver and promote to.
            getLogger().debug( "Promoting and delivering..." );

            // So we deliver the code to the target stream (or workspace)
            getLogger().debug( "Delivering..." );
            JazzScmCommand tagDeliverCommand = createTagDeliverCommand( jazzRepo, fileSet, tag );
            errConsumer = new ErrorConsumer( getLogger() );
            status = tagDeliverCommand.execute( tagConsumer, errConsumer );
            if ( status != 0 || errConsumer.hasBeenFed() )
            {
                return new TagScmResult( tagDeliverCommand.getCommandString(),
                                         "Error code for Jazz SCM deliver command - " + status, errConsumer.getOutput(),
                                         false );
            }

            // And now we promote the snapshot to the target stream (or workspace)
            getLogger().debug( "Promoting snapshot..." );
            JazzScmCommand tagSnapshotPromoteCommand = createTagSnapshotPromoteCommand( jazzRepo, fileSet, tag );
            errConsumer = new ErrorConsumer( getLogger() );
            status = tagSnapshotPromoteCommand.execute( tagConsumer, errConsumer );
            if ( status != 0 || errConsumer.hasBeenFed() )
            {
                return new TagScmResult( tagSnapshotPromoteCommand.getCommandString(),
                                         "Error code for Jazz SCM snapshot promote command - " + status,
                                         errConsumer.getOutput(), false );
            }
        }
View Full Code Here

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

    // Create the JazzScmCommand to execute the "scm create snapshot ..." command
    // This will create a snapshot of the remote repository
    public JazzScmCommand createTagCreateSnapshotCommand( JazzScmProviderRepository repo, ScmFileSet fileSet,
                                                          String tag, ScmTagParameters scmTagParameters )
    {
        JazzScmCommand command =
            new JazzScmCommand( JazzConstants.CMD_CREATE, JazzConstants.CMD_SUB_SNAPSHOT, repo, fileSet, getLogger() );

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

        String message = scmTagParameters.getMessage();
        if ( message != null && !message.trim().equals( "" ) )
        {
            command.addArgument( JazzConstants.ARG_SNAPSHOT_DESCRIPTION );
            command.addArgument( message );
        }

        command.addArgument( repo.getRepositoryWorkspace() );

        return command;
    }
View Full Code Here

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

    // Create the JazzScmCommand to execute the "scm snapshot promote ..." command
    // This will promote the snapshot to the flow target (the stream or other workspace).
    public JazzScmCommand createTagSnapshotPromoteCommand( JazzScmProviderRepository repo, ScmFileSet fileSet,
                                                           String tag )
    {
        JazzScmCommand command =
            new JazzScmCommand( JazzConstants.CMD_SNAPSHOT, JazzConstants.CMD_SUB_PROMOTE, repo, fileSet, getLogger() );

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

        return command;
    }
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.