Examples of TagScmResult


Examples of org.apache.maven.scm.command.tag.TagScmResult

                                           ScmTagParameters scmTagParameters )
        throws ScmException
    {
        getLogger().info(
            "Attempting to checkpoint project associated with sandbox " + fileSet.getBasedir().getAbsolutePath() );
        TagScmResult result;
        String message = scmTagParameters.getMessage();
        IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;

        try
        {
            // First validate the checkpoint label string by evaluating the groovy script
            String chkptLabel = evalGroovyExpression( tagName );
            Project.validateTag( chkptLabel );
            String msg = ( ( null == message || message.length() == 0 ) ? System.getProperty( "message" ) : message );
            // Get information about the Project
            Project siProject = iRepo.getProject();
            // Ensure this is not a build project configuration
            if ( !siProject.isBuild() )
            {
                Response res = siProject.checkpoint( msg, chkptLabel );
                int exitCode = res.getExitCode();
                boolean success = ( exitCode == 0 ? true : false );
                WorkItem wi = res.getWorkItem( siProject.getConfigurationPath() );
                String chkpt = wi.getResult().getField( "resultant" ).getItem().getId();
                getLogger().info(
                    "Successfully checkpointed project " + siProject.getConfigurationPath() + " with label '"
                        + chkptLabel + "', new revision is " + chkpt );
                result =
                    new TagScmResult( res.getCommandString(), wi.getResult().getMessage(), "Exit Code: " + exitCode,
                                      success );
            }
            else
            {
                getLogger().error(
                    "Cannot checkpoint a build project configuration: " + siProject.getConfigurationPath() + "!" );
                result =
                    new TagScmResult( "si checkpoint", "Cannot checkpoint a build project configuration!", "", false );
            }
        }
        catch ( CompilationFailedException cfe )
        {
            getLogger().error( "Groovy Compilation Exception: " + cfe.getMessage() );
            result = new TagScmResult( "si checkpoint", cfe.getMessage(), "", false );
        }
        catch ( APIException aex )
        {
            ExceptionHandler eh = new ExceptionHandler( aex );
            getLogger().error( "MKS API Exception: " + eh.getMessage() );
            getLogger().info( eh.getCommand() + " exited with return code " + eh.getExitCode() );
            result = new TagScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false );
        }
        catch ( Exception e )
        {
            getLogger().error( "Failed to checkpoint project! " + e.getMessage() );
            result = new TagScmResult( "si checkpoint", e.getMessage(), "", false );
        }
        return result;
    }
View Full Code Here

Examples of org.apache.maven.scm.command.tag.TagScmResult

                {
                    fileList.add( new ScmFile( f.getPath(), ScmFileStatus.TAGGED ) );
                }
            }

            return new TagScmResult( fileList, result );
        }
        else
        {
            throw new ScmException( "Error while executing command " + cmd.toString() );
        }
View Full Code Here

Examples of org.apache.maven.scm.command.tag.TagScmResult

    public void testTagCommandTest()
        throws Exception
    {
        String tag = "test-tag";

        @SuppressWarnings( "deprecation" ) TagScmResult tagResult =
            getScmManager().getProviderByUrl( getScmUrl() ).tag( getScmRepository(), new ScmFileSet( getWorkingCopy() ),
                                                                 tag );

        assertResultIsSuccess( tagResult );

        assertEquals( "check all 4 files tagged", 4, tagResult.getTaggedFiles().size() );

        File readmeTxt = new File( getWorkingCopy(), "readme.txt" );

        assertEquals( "check readme.txt contents", "/readme.txt", FileUtils.fileRead( readmeTxt ) );
View Full Code Here

Examples of org.apache.maven.scm.command.tag.TagScmResult

            {
                getLogger().debug( "VSS returns error: [" + error + "] return code: [" + exitCode + "]" );
            }
            if ( error.indexOf( "A writable copy of" ) < 0 )
            {
                return new TagScmResult( cl.toString(), "The vss command failed.", error, false );
            }
            // print out the writable copy for manual handling
            if ( getLogger().isWarnEnabled() )
            {
                getLogger().warn( error );
            }
        }

        return new TagScmResult( cl.toString(), consumer.getUpdatedFiles() );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.tag.TagScmResult

            FileUtils.fileWrite( messageFile.getAbsolutePath(), scmTagParameters == null ? "" : scmTagParameters
                .getMessage() );
        }
        catch ( IOException ex )
        {
            return new TagScmResult( null, "Error while making a temporary file for the commit message: "
                + ex.getMessage(), null, false );
        }
      
        Commandline cl = createCommandLine( repository, fileSet.getBasedir(), tag, messageFile, scmTagParameters );
       
        CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();

        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();

        if ( getLogger().isInfoEnabled() )
        {
            getLogger().info( "Executing: " + SvnCommandLineUtils.cryptPassword( cl ) );
            getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() );
        }

        int exitCode;

        try
        {
            exitCode = SvnCommandLineUtils.execute( cl, stdout, stderr, getLogger() );
        }
        catch ( CommandLineException ex )
        {
            throw new ScmException( "Error while executing command.", ex );
        }
        finally
        {
            try
            {
                FileUtils.forceDelete( messageFile );
            }
            catch ( IOException ex )
            {
                // ignore
            }
        }

        if ( exitCode != 0 )
        {
            // TODO: Improve this error message
            return new TagScmResult( cl.toString(), "The svn tag command failed.", stderr.getOutput(), false );
        }

        List<ScmFile> fileList = new ArrayList<ScmFile>();

        List<File> files = null;

        try
        {
            if ( StringUtils.isNotEmpty( fileSet.getExcludes() ) )
            {
                @SuppressWarnings( "unchecked" )
                List<File> list =
                    FileUtils.getFiles( fileSet.getBasedir(),
                                        ( StringUtils.isEmpty( fileSet.getIncludes() ) ? "**"
                                                        : fileSet.getIncludes() ), fileSet.getExcludes()
                                            + ",**/.svn/**", false );
                files = list;
            }
            else
            {
                @SuppressWarnings( "unchecked" )
                List<File> list =
                    FileUtils.getFiles( fileSet.getBasedir(),
                                        ( StringUtils.isEmpty( fileSet.getIncludes() ) ? "**"
                                                        : fileSet.getIncludes() ), "**/.svn/**", false );
                files = list;
            }
        }
        catch ( IOException e )
        {
            throw new ScmException( "Error while executing command.", e );
        }

        for ( Iterator<File> i = files.iterator(); i.hasNext(); )
        {
            File f = i.next();

            fileList.add( new ScmFile( f.getPath(), ScmFileStatus.TAGGED ) );
        }

        return new TagScmResult( cl.toString(), fileList );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.tag.TagScmResult

{
    /** {@inheritDoc} */
    protected ScmResult executeTagCommand( ScmProviderRepository repository, ScmFileSet fileSet, String message, ScmTagParameters scmTagParameters)
        throws ScmException
    {
        return new TagScmResult( null, Collections.<ScmFile>emptyList() );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.tag.TagScmResult

    //Satisfies deprecated interface
    /** {@inheritDoc} */
    protected ScmResult executeTagCommand( ScmProviderRepository repository, ScmFileSet fileSet, String tagName, String message)
        throws ScmException
    {
        return new TagScmResult( null, Collections.<ScmFile>emptyList() );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.tag.TagScmResult

        int exitCode = StarteamCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() );

        if ( exitCode != 0 )
        {
            return new TagScmResult( cl.toString(), "The starteam command failed.", stderr.getOutput(), false );
        }

        return new TagScmResult( cl.toString(), consumer.getTaggedFiles() );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.tag.TagScmResult

            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 );
            }
        }

        // We don't have a JazzTagConsumer so just build up all the files...
        List<ScmFile> taggedFiles = new ArrayList<ScmFile>( fileSet.getFileList().size() );
        for ( File f : fileSet.getFileList() )
        {
            taggedFiles.add( new ScmFile( f.getPath(), ScmFileStatus.TAGGED ) );
        }

        // We return the "main" or "primary" command executed.
        // This is similar to the git provider, where the main command is returned.
        // So we return tagSnapshotCmd and not tagWorkspaceCmd.
        return new TagScmResult( tagCreateSnapshotCmd.getCommandString(), taggedFiles );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.tag.TagScmResult

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