Package org.apache.maven.scm.command.update

Examples of org.apache.maven.scm.command.update.UpdateScmResult


        catch ( NoSuchScmProviderException e )
        {
            throw new ReleaseExecutionException( "Unable to configure SCM repository: " + e.getMessage(), e );
        }

        UpdateScmResult result;
        try
        {
            result = provider.update( repository, new ScmFileSet( new File( releaseDescriptor.getWorkingDirectory() ) ),
                                      (ScmVersion) null );
        }
        catch ( ScmException e )
        {
            throw new ReleaseExecutionException( "An error occurred while updating your local copy: " + e.getMessage(),
                                                 e );
        }

        if ( !result.isSuccess() )
        {
            throw new ReleaseScmCommandException( "Unable to update current working copy", result );
        }

        copyUpdated = ( result.getUpdatedFiles().size() > 0 );

        relResult.setResultCode( ReleaseResult.SUCCESS );

        return relResult;
    }
View Full Code Here


    {
        Project project = projectDao.getProject( getProject( context ).getId() );

        BuildDefinition buildDefinition = getBuildDefinition( context );

        UpdateScmResult scmResult;

        ScmResult result;

        Date latestUpdateDate = null;

        try
        {
            BuildResult buildResult = buildResultDao.getLatestBuildResultForProject( project.getId() );

            latestUpdateDate = new Date( buildResult.getStartTime() );
        }
        catch ( Exception e )
        {
        }

        try
        {
            notifier.checkoutStarted( project, buildDefinition );

            // TODO: not sure why this is different to the context, but it all needs to change
            File workingDirectory = workingDirectoryService.getWorkingDirectory( project );
            ContinuumScmConfiguration config = createScmConfiguration( project, workingDirectory );
            config.setLatestUpdateDate( latestUpdateDate );
            String tag = config.getTag();
            String msg =
                project.getName() + "', id: '" + project.getId() + "' to '" + workingDirectory.getAbsolutePath() + "'" +
                    ( tag != null ? " with branch/tag " + tag + "." : "." );
            getLogger().info( "Updating project: " + msg );
            scmResult = scm.update( config );

            if ( !scmResult.isSuccess() )
            {
                getLogger().warn( "Error while updating the code for project: '" + msg );

                getLogger().warn( "Command output: " + scmResult.getCommandOutput() );

                getLogger().warn( "Provider message: " + scmResult.getProviderMessage() );
            }

            if ( scmResult.getUpdatedFiles() != null && scmResult.getUpdatedFiles().size() > 0 )
            {
                getLogger().info( "Updated " + scmResult.getUpdatedFiles().size() + " files." );
            }

            result = convertScmResult( scmResult );
        }
        catch ( ScmRepositoryException e )
View Full Code Here

    {
        Project project = projectDao.getProject( getProject( context ).getId() );

        BuildDefinition buildDefinition = getBuildDefinition( context );

        UpdateScmResult scmResult;

        ScmResult result;

        Date latestUpdateDate = null;

        try
        {
            BuildResult buildResult = buildResultDao.getLatestBuildResultForProject( project.getId() );

            latestUpdateDate = new Date( buildResult.getStartTime() );
        }
        catch ( Exception e )
        {
        }

        try
        {
            notifier.checkoutStarted( project, buildDefinition );

            // TODO: not sure why this is different to the context, but it all needs to change
            File workingDirectory = workingDirectoryService.getWorkingDirectory( project );
            ContinuumScmConfiguration config = createScmConfiguration( project, workingDirectory );
            config.setLatestUpdateDate( latestUpdateDate );
            String tag = config.getTag();
            String msg = project.getName() + "', id: '" + project.getId() + "' to '" +
                workingDirectory.getAbsolutePath() + "'" + ( tag != null ? " with branch/tag " + tag + "." : "." );
            getLogger().info( "Updating project: " + msg );
            scmResult = scm.update( config );

            if ( !scmResult.isSuccess() )
            {
                getLogger().warn( "Error while updating the code for project: '" + msg );

                getLogger().warn( "Command output: " + scmResult.getCommandOutput() );

                getLogger().warn( "Provider message: " + scmResult.getProviderMessage() );
            }

            if ( scmResult.getUpdatedFiles() != null && scmResult.getUpdatedFiles().size() > 0 )
            {
                getLogger().info( "Updated " + scmResult.getUpdatedFiles().size() + " files." );
            }

            result = convertScmResult( scmResult );
        }
        catch ( ScmRepositoryException e )
View Full Code Here

            // Remove the clientspec name, so it will be recalculated between each command for each project
            // instead of use the same for all projects
            System.setProperty( "maven.scm.starteam.deleteLocal", "true" );
        }

        UpdateScmResult result;

        ScmFileSet fileSet = new ScmFileSet( workingDirectory );

        // TODO: shouldn't need to synchronize this
        synchronized ( this )
View Full Code Here

            // Remove the clientspec name, so it will be recalculated between each command for each project
            // instead of use the same for all projects
            System.setProperty( "maven.scm.starteam.deleteLocal", "true" );
        }

        UpdateScmResult result;

        ScmFileSet fileSet = new ScmFileSet( workingDirectory );

        // TODO: shouldn't need to synchronize this
        synchronized ( this )
View Full Code Here

    public void execute( Map context )
        throws Exception
    {
        Project project = ContinuumBuildAgentUtil.getProject( context );

        UpdateScmResult scmResult;

        ScmResult result;
       
        try
        {
            File workingDirectory = buildAgentConfigurationService.getWorkingDirectory( project.getId() );
            ContinuumScmConfiguration config = createScmConfiguration( project, workingDirectory );
            config.setLatestUpdateDate( ContinuumBuildAgentUtil.getLatestUpdateDate( context ) );
            String tag = config.getTag();
            String msg = project.getName() + "', id: '" + project.getId() + "' to '" +
                workingDirectory.getAbsolutePath() + "'" + ( tag != null ? " with branch/tag " + tag + "." : "." );
            getLogger().info( "Updating project: " + msg );
            scmResult = scm.update( config );

            if ( !scmResult.isSuccess() )
            {
                getLogger().warn( "Error while updating the code for project: '" + msg );

                getLogger().warn( "Command output: " + scmResult.getCommandOutput() );

                getLogger().warn( "Provider message: " + scmResult.getProviderMessage() );
            }

            if ( scmResult.getUpdatedFiles() != null && scmResult.getUpdatedFiles().size() > 0 )
            {
                getLogger().info( "Updated " + scmResult.getUpdatedFiles().size() + " files." );
            }

            result = convertScmResult( scmResult );
        }
        catch ( ScmRepositoryException e )
View Full Code Here

        }
        ScmResult updateResult = HgUtils.execute( new HgConsumer( getLogger() ), getLogger(), workingDir, updateCmd );

        if ( !updateResult.isSuccess() )
        {
            return new UpdateScmResult( null, null, updateResult );
        }

        // Find changes from last revision
        int currentRevision = HgUtils.getCurrentRevisionNumber( getLogger(), workingDir );
        int previousRevision = currentRevision - 1;
View Full Code Here

                                                               ? ScmFileStatus.DELETED
                                                               : ScmFileStatus.UPDATED ) );
                        }
                    }
                }
                return new UpdateScmResult( res.getCommandString(), updatedFiles );
            }
            else
            {
                return new UpdateScmResult( "si resync", "Failed to synchronize workspace", "", 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() );
            return new UpdateScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false );
        }
    }
View Full Code Here

        AccuRevScmProviderRepository accurevRepo = (AccuRevScmProviderRepository) repository;

        AccuRevUpdateCommand command = new AccuRevUpdateCommand( getLogger() );

        UpdateScmResult result = command.update( repository, fileSet, parameters );

        if ( result.isSuccess() && parameters.getBoolean( CommandParameter.RUN_CHANGELOG_WITH_UPDATE ) )
        {
            AccuRevUpdateScmResult accuRevResult = (AccuRevUpdateScmResult) result;

            ScmRevision fromRevision = new ScmRevision( accuRevResult.getFromRevision() );
            ScmRevision toRevision = new ScmRevision( accuRevResult.getToRevision() );

            parameters.setScmVersion( CommandParameter.START_SCM_VERSION, fromRevision );
            parameters.setScmVersion( CommandParameter.END_SCM_VERSION, toRevision );

            AccuRevVersion startVersion = accurevRepo.getAccuRevVersion( fromRevision );
            AccuRevVersion endVersion = accurevRepo.getAccuRevVersion( toRevision );
            if ( startVersion.getBasisStream().equals( endVersion.getBasisStream() ) )
            {
                ChangeLogScmResult changeLogResult = changelog( repository, fileSet, parameters );

                if ( changeLogResult.isSuccess() )
                {
                    result.setChanges( changeLogResult.getChangeLog().getChangeSets() );
                }
                else
                {
                    getLogger().warn( "Changelog from " + fromRevision + " to " + toRevision + " failed" );
                }
            }
            else
            {
                String comment = "Cross stream update result from " + startVersion + " to " + endVersion;
                String author = "";
                List<ScmFile> files = result.getUpdatedFiles();
                List<ChangeFile> changeFiles = new ArrayList<ChangeFile>( files.size() );
                for ( ScmFile scmFile : files )
                {
                    changeFiles.add( new ChangeFile( scmFile.getPath() ) );
                }
                ChangeSet dummyChangeSet = new ChangeSet( new Date(), comment, author, changeFiles );
                // different streams invalidates the change log, insert a dummy change instead.
                List<ChangeSet> changeSets = Collections.singletonList( dummyChangeSet );
                result.setChanges( changeSets );
            }

        }
        return result;
    }
View Full Code Here

        Commandline clRev = createLatestRevisionCommandLine( repository, fileSet.getBasedir(), scmVersion );
        GitLatestRevisionCommandConsumer consumerRev = new GitLatestRevisionCommandConsumer( getLogger() );
        exitCode = GitCommandLineUtils.execute( clRev, consumerRev, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            return new UpdateScmResult( clRev.toString(), "The git-log command failed.",
                    stderr.getOutput(), false );
        }
        String origSha1 = consumerRev.getLatestRevision();

        Commandline cl = createCommandLine( repository, fileSet.getBasedir(), scmVersion );
        exitCode = GitCommandLineUtils.execute( cl, stdout, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            return new UpdateScmResult( cl.toString(), "The git-pull command failed.",
                                        stderr.getOutput(), false );
        }

        // we also need to log exactly what has been updated
        GitDiffRawConsumer diffRawConsumer = new GitDiffRawConsumer( getLogger() );
        Commandline clDiffRaw = GitDiffCommand.createDiffRawCommandLine( fileSet.getBasedir(), origSha1 );
        exitCode = GitCommandLineUtils.execute( clDiffRaw, diffRawConsumer, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            return new UpdateScmResult( clDiffRaw.toString(), "The git-diff --raw command failed.",
                    stderr.getOutput(), false );
        }

       
        // now let's get the latest version
        consumerRev = new GitLatestRevisionCommandConsumer( getLogger() );
        exitCode = GitCommandLineUtils.execute( clRev, consumerRev, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            return new UpdateScmResult( clRev.toString(), "The git-log command failed.",
                                        stderr.getOutput(), false );
        }
        String latestRevision = consumerRev.getLatestRevision();
       
        return new UpdateScmResultWithRevision( cl.toString(), diffRawConsumer.getChangedFiles(), latestRevision );
View Full Code Here

TOP

Related Classes of org.apache.maven.scm.command.update.UpdateScmResult

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.