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() )
        {
            for( File file : files )
            {
                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

            getLogger().debug( "Executing checkin command..." );
        }

        // Create a changeset. We need to do this, as otherwise the information contained in the message
        // will be lost forever.
        JazzScmCommand createChangesetCmd = createCreateChangesetCommand( repository, fileSet, message );
        DebugLoggerConsumer outputConsumer = new DebugLoggerConsumer( getLogger() );
        ErrorConsumer errConsumer = new ErrorConsumer( getLogger() );

        int status = createChangesetCmd.execute( outputConsumer, errConsumer );
        if ( status != 0 || errConsumer.hasBeenFed() )
        {
            return new CheckInScmResult( createChangesetCmd.getCommandString(),
                                         "Error code for Jazz SCM create changeset command - " + status,
                                         errConsumer.getOutput(), false );
        }

        // Now check in the files themselves.
View Full Code Here

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

        // Now, if it has a flow target, deliver it.
        JazzScmProviderRepository jazzRepo = (JazzScmProviderRepository) repo;
        if ( jazzRepo.isPushChangesAndHaveFlowTargets() )
        {
            // Push if we need too
            JazzScmCommand deliverCmd = createDeliverCommand( (JazzScmProviderRepository) repo, fileSet );
            StreamConsumer deliverConsumer =
                new DebugLoggerConsumer( getLogger() );      // No need for a dedicated consumer for this
            ErrorConsumer errConsumer = new ErrorConsumer( getLogger() );

            int status = deliverCmd.execute( deliverConsumer, errConsumer );
            if ( status != 0 || errConsumer.hasBeenFed() )
            {
                return new CheckInScmResult( deliverCmd.getCommandString(),
                                             "Error code for Jazz SCM deliver command - " + status,
                                             errConsumer.getOutput(), false );
            }
        }
View Full Code Here

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

        return new CheckInScmResult( addResult.getCommandLine(), addResult.getAddedFiles() );
    }

    public JazzScmCommand createCreateChangesetCommand( ScmProviderRepository repo, ScmFileSet fileSet, String message )
    {
        JazzScmCommand command =
            new JazzScmCommand( JazzConstants.CMD_CREATE, JazzConstants.CMD_SUB_CHANGESET, repo, false, fileSet,
                                getLogger() );
        command.addArgument( message );

        return command;
    }
View Full Code Here

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

        return command;
    }

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

        // TODO, this was taken out to quickly test how the release plugin works.
        // The release plugin has the fileSet.getbaseDir() as the project it is checking in
        // This happens to be a folder under the sandbox root, and so the checkin would fail because it needs
        // to check in at the sandbox root level (not sub folders)
        // The SCM Plugin has a basedir parameter that you can pass it, so everythig works ok from the scm-plugin alone
        // but the release-plugin doesn't look like it lets you do that. (or I didn't have enough time
        // to figure out how to do it properly).

        // if (fileSet != null) {
        // command.addArgument(JazzConstants.LOAD_ROOT_DIRECTORY_ARG);
        // command.addArgument(fileSet.getBasedir().getAbsolutePath());
        // }

        List<File> files = fileSet.getFileList();
        if ( files != null && !files.isEmpty() )
        {
            for ( File file : files )
            {
                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

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

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

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

        // This command is needed so that the deliver operation will work.
        // Files that are not under source control (a--) [temp files etc]
        // will cause the deliver operation to fail with the error:
        // "Cannot deliver because there are one or more items that are not checked in.
        // Check in the changes or rerun with --overwrite-uncommitted."
        // However, from the maven perspective, we only need files that are
        // under source control to be delivered. Maven has already checked
        // for this (via the status command).
        //
        // So we add this argument to allow the deliver to work.
        command.addArgument( JazzConstants.ARG_OVERWRITE_UNCOMMITTED );

        return command;
    }
View Full Code Here

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

            getLogger().debug( "Executing checkout command..." );
        }

        JazzScmProviderRepository jazzRepo = (JazzScmProviderRepository) repo;

        JazzScmCommand checkoutCmd = createJazzLoadCommand( jazzRepo, fileSet, scmVersion );
        JazzCheckOutConsumer checkoutConsumer = new JazzCheckOutConsumer( repo, getLogger() );
        ErrorConsumer errConsumer = new ErrorConsumer( getLogger() );

        int status = checkoutCmd.execute( checkoutConsumer, errConsumer );
        if ( status != 0 || errConsumer.hasBeenFed() )
        {
            return new CheckOutScmResult( checkoutCmd.getCommandString(),
                                          "Error code for Jazz SCM checkout (load) command - " + status,
                                          errConsumer.getOutput(), false );
        }

        return new CheckOutScmResult( checkoutCmd.getCommandString(), checkoutConsumer.getCheckedOutFiles() );
    }
View Full Code Here

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

    }

    public JazzScmCommand createJazzLoadCommand( JazzScmProviderRepository repo, ScmFileSet fileSet,
                                                 ScmVersion scmVersion )
    {
        JazzScmCommand command =
            new JazzScmCommand( JazzConstants.CMD_LOAD, JazzConstants.ARG_FORCE, repo, fileSet, getLogger() );

        if ( fileSet != null )
        {
            command.addArgument( JazzConstants.ARG_LOCAL_WORKSPACE_PATH );
            command.addArgument( fileSet.getBasedir().getAbsolutePath() );
        }

        // This works in tandem with the Tag Command.
        // Currently, RTC can not check out directly from a snapshot.
        // So, as a work around, the Tag Command creates a workspace name of the same name as the snapshot.
        // The functionality here (in using the ScmTag or ScmBranch) assumes that the workspace has been
        // created as a part of the Tag Command.

        String workspace = repo.getRepositoryWorkspace();
        if ( scmVersion != null && StringUtils.isNotEmpty( scmVersion.getName() ) )
        {
            // Just in case we ever do something different for Tags (snapshots) and Branches (streams)
            if ( scmVersion instanceof ScmTag )
            {
                workspace = scmVersion.getName();
            }
            else if ( scmVersion instanceof ScmBranch )
            {
                workspace = scmVersion.getName();
            }
        }

        command.addArgument( workspace );

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

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
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.