Package org.apache.maven.scm.provider.accurev

Examples of org.apache.maven.scm.provider.accurev.AccuRev


    @Override
    protected ScmResult getScmResult( AccuRevScmProviderRepository repository, List<ScmFile> scmFiles,
                                      ScmVersion version )
    {
        AccuRev accuRev = repository.getAccuRev();
        if ( scmFiles != null )
        {
            return new CheckOutScmResult( accuRev.getCommandLines(), scmFiles, repository.getProjectPath() );
        }
        else
        {
            return new CheckOutScmResult( accuRev.getCommandLines(), "AccuRev Error", accuRev.getErrorOutput(), false );
        }
    }
View Full Code Here


    protected ScmResult executeAccurevCommand( AccuRevScmProviderRepository repository, ScmFileSet fileSet,
                                               CommandParameters parameters )
        throws ScmException, AccuRevException
    {

        AccuRev accuRev = repository.getAccuRev();

        String snapshotName = parameters.getString( CommandParameter.TAG_NAME );

        snapshotName = repository.getSnapshotName( snapshotName );

        File basedir = fileSet.getBasedir();
        boolean success = true;

        AccuRevInfo info = accuRev.info( basedir );
        List<File> taggedFiles = null;

        success = accuRev.mksnap( snapshotName, info.getBasis() );
        if ( success )
        {
            taggedFiles = accuRev.statTag( snapshotName );
        }

        if ( success && taggedFiles != null )
        {
            return new TagScmResult( accuRev.getCommandLines(), getScmFiles( taggedFiles, ScmFileStatus.TAGGED ) );
        }
        else
        {
            return new TagScmResult( accuRev.getCommandLines(), "AccuRev error", accuRev.getErrorOutput(), false );
        }
    }
View Full Code Here

    protected ScmResult executeAccurevCommand( AccuRevScmProviderRepository repository, ScmFileSet fileSet,
                                               CommandParameters parameters )
        throws ScmException, AccuRevException
    {
        boolean result = false;
        AccuRev accurev = repository.getAccuRev();
        AccuRevInfo info = accurev.info( null );

        String providerMessage = "";
        if ( info == null )
        {
            providerMessage = "Unable to retrieve accurev info";
        }
        else if ( repository.getUser() != null )
        {
            // Check if we've already logged in as this user
            result = repository.getUser().equals( info.getUser() );
            if ( result )
            {
                providerMessage = "Skipping login - already logged in as " + repository.getUser();
            }
            else
            {
                result = accurev.login( repository.getUser(), repository.getPassword() );
                providerMessage = ( result ? "Success" : "Failure" ) + " logging in as " + repository.getUser();
            }
        }
        else
        {
            result = info.isLoggedIn();
            providerMessage = result ? ( "Logged in externally as " + info.getUser() ) : "Not logged in";
        }

        getLogger().debug( providerMessage );
        return new LoginScmResult( accurev.getCommandLines(), providerMessage, accurev.getErrorOutput(), result );

    }
View Full Code Here

    protected ScmResult executeAccurevCommand( AccuRevScmProviderRepository repository, ScmFileSet fileSet,
                                               CommandParameters parameters )
        throws ScmException, AccuRevException
    {

        AccuRev accuRev = repository.getAccuRev();

        File basedir = fileSet.getBasedir();

        AccuRevInfo info = accuRev.info( basedir );

        if ( !info.isWorkSpace() )
        {
            throw new AccuRevException( "No workspace at " + basedir.getAbsolutePath() );
        }

        String startRevision = getStartRevision( repository, parameters, info );

        ScmVersion scmVersion = parameters.getScmVersion( CommandParameter.SCM_VERSION, null );

        String updateTransactionId = null;

        if ( scmVersion != null )
        {
            AccuRevVersion updateVersion = repository.getAccuRevVersion( scmVersion );

            // Reparent if necessary
            String newBasisStream = updateVersion.getBasisStream();
            if ( newBasisStream != null
                && ( !( newBasisStream.equals( info.getWorkSpace() ) || newBasisStream.equals( info.getBasis() ) ) ) )
            {
                getLogger().info( "Reparenting " + info.getWorkSpace() + " to " + newBasisStream );
                accuRev.chws( basedir, info.getWorkSpace(), newBasisStream );
            }

            if ( !updateVersion.isNow() )
            {
                updateTransactionId = updateVersion.getTimeSpec();
            }
        }

        if ( updateTransactionId == null )
        {
            updateTransactionId = repository.getDepotTransactionId( info.getWorkSpace(), "now" );
        }

        String endRevision = repository.getRevision( info.getWorkSpace(), updateTransactionId );

        List<File> updatedFiles = accuRev.update( basedir, updateTransactionId );

        if ( updatedFiles != null )
        {
            return new AccuRevUpdateScmResult( accuRev.getCommandLines(), getScmFiles( updatedFiles,
                                                                                       ScmFileStatus.UPDATED ),
                                               startRevision, endRevision );
        }
        else
        {
            return new AccuRevUpdateScmResult( accuRev.getCommandLines(), "AccuRev error", accuRev.getErrorOutput(),
                                               null, null, false );
        }
    }
View Full Code Here

        List<Transaction> workspaceHistory = Collections.emptyList();
        List<FileDifference> streamDifferences = Collections.emptyList();

        StringBuilder errorMessage = new StringBuilder();

        AccuRev accurev = repository.getAccuRev();

        Stream changelogStream = accurev.showStream( stream );
        if ( changelogStream == null )
        {
            errorMessage.append( "Unknown accurev stream -" ).append( stream ).append( "." );
        }
        else
        {

            String message =
                "Changelog on stream " + stream + "(" + changelogStream.getStreamType() + ") from " + fromTranId + " ("
                    + startDate + "), to " + toTranId + " (" + endDate + ")";

            if ( startDate != null && startDate.after( endDate ) || fromTranId >= toTranId )
            {
                getLogger().warn( "Skipping out of range " + message );
            }
            else
            {

                getLogger().info( message );

                // In 4.7.2 and higher we have a diff command that will list all the file differences in a stream
                // and thus can be used to detect upstream changes
                // Unfortunately diff -v -V -t does not work in workspaces.
                Stream diffStream = changelogStream;
                if ( changelogStream.isWorkspace() )
                {

                    workspaceHistory =
                        accurev.history( stream, Long.toString( fromTranId + 1 ), Long.toString( toTranId ), 0, false,
                                         false );

                    if ( workspaceHistory == null )
                    {
                        errorMessage.append( "history on workspace " + stream + " from " + fromTranId + 1 + " to "
                            + toTranId + " failed." );

                    }

                    // do the diff/hist on the basis stream instead.
                    stream = changelogStream.getBasis();
                    diffStream = accurev.showStream( stream );

                }

                if ( AccuRevCapability.DIFF_BETWEEN_STREAMS.isSupported( accurev.getClientVersion() ) )
                {
                    if ( startDate.before( diffStream.getStartDate() ) )
                    {
                        getLogger().warn( "Skipping diff of " + stream + " due to start date out of range" );
                    }
                    else
                    {
                        streamDifferences =
                            accurev.diff( stream, Long.toString( fromTranId ), Long.toString( toTranId ) );
                        if ( streamDifferences == null )
                        {
                            errorMessage.append( "Diff " + stream + "- " + fromTranId + " to " + toTranId + "failed." );
                        }
                    }
                }

                // History needs to start from the transaction after our starting transaction

                streamHistory =
                    accurev.history( stream, Long.toString( fromTranId + 1 ), Long.toString( toTranId ), 0, false,
                                     false );
                if ( streamHistory == null )
                {
                    errorMessage.append( "history on stream " + stream + " from " + fromTranId + 1 + " to " + toTranId
                        + " failed." );
                }

            }
        }

        String errorString = errorMessage.toString();
        if ( StringUtils.isBlank( errorString ) )
        {
            ChangeLogSet changeLog =
                getChangeLog( changelogStream, streamDifferences, streamHistory, workspaceHistory, startDate, endDate );

            changeLog.setEndVersion( endVersion );
            changeLog.setStartVersion( startVersion );

            return new ChangeLogScmResult( accurev.getCommandLines(), changeLog );
        }
        else
        {
            return new ChangeLogScmResult( accurev.getCommandLines(), "AccuRev errors: " + errorMessage,
                                           accurev.getErrorOutput(), false );
        }

    }
View Full Code Here

    protected ScmResult executeAccurevCommand( AccuRevScmProviderRepository repository, ScmFileSet fileSet,
                                               CommandParameters parameters )
        throws ScmException, AccuRevException
    {

        AccuRev accuRev = repository.getAccuRev();

        String message = parameters.getString( CommandParameter.MESSAGE, "" );

        File basedir = fileSet.getBasedir();

        List<File> relativeFiles = fileSet.getFileList();

        List<File> addedFiles = accuRev.add( basedir, relativeFiles, message );

        if ( addedFiles != null )
        {
            List<ScmFile> resultFiles = getScmFiles( addedFiles, ScmFileStatus.ADDED );
            return new AddScmResult( accuRev.getCommandLines(), resultFiles );
        }
        else
        {
            return new AddScmResult( accuRev.getCommandLines(), "AccuRev Error", accuRev.getErrorOutput(), false );
        }
    }
View Full Code Here

        List<Transaction> workspaceHistory = Collections.emptyList();
        List<FileDifference> streamDifferences = Collections.emptyList();

        StringBuffer errorMessage = new StringBuffer();

        AccuRev accurev = repository.getAccuRev();

        Stream changelogStream = accurev.showStream( stream );
        if ( changelogStream == null )
        {
            errorMessage.append( "Unknown accurev stream -" ).append( stream ).append( "." );
        }
        else
        {

            String message =
                "Changelog on stream " + stream + "(" + changelogStream.getStreamType() + ") from " + fromTranId + " ("
                    + startDate + "), to " + toTranId + " (" + endDate + ")";

            if ( startDate != null && startDate.after( endDate ) || fromTranId >= toTranId )
            {
                getLogger().warn( "Skipping out of range " + message );
            }
            else
            {

                getLogger().info( message );

                // In 4.7.2 and higher we have a diff command that will list all the file differences in a stream
                // and thus can be used to detect upstream changes
                // Unfortunately diff -v -V -t does not work in workspaces.
                Stream diffStream = changelogStream;
                if ( changelogStream.isWorkspace() )
                {

                    workspaceHistory =
                        accurev.history( stream, Long.toString( fromTranId + 1 ), Long.toString( toTranId ), 0, false,
                                         false );

                    if ( workspaceHistory == null )
                    {
                        errorMessage.append( "history on workspace " + stream + " from " + fromTranId + 1 + " to "
                            + toTranId + " failed." );

                    }

                    // do the diff/hist on the basis stream instead.
                    stream = changelogStream.getBasis();
                    diffStream = accurev.showStream( stream );

                }

                if ( AccuRevCapability.DIFF_BETWEEN_STREAMS.isSupported( accurev.getClientVersion() ) )
                {
                    if ( startDate.before( diffStream.getStartDate() ) )
                    {
                        getLogger().warn( "Skipping diff of " + stream + " due to start date out of range" );
                    }
                    else
                    {
                        streamDifferences =
                            accurev.diff( stream, Long.toString( fromTranId ), Long.toString( toTranId ) );
                        if ( streamDifferences == null )
                        {
                            errorMessage.append( "Diff " + stream + "- " + fromTranId + " to " + toTranId + "failed." );
                        }
                    }
                }

                // History needs to start from the transaction after our starting transaction

                streamHistory =
                    accurev.history( stream, Long.toString( fromTranId + 1 ), Long.toString( toTranId ), 0, false,
                                     false );
                if ( streamHistory == null )
                {
                    errorMessage.append( "history on stream " + stream + " from " + fromTranId + 1 + " to " + toTranId
                        + " failed." );
                }

            }
        }

        String errorString = errorMessage.toString();
        if ( StringUtils.isBlank( errorString ) )
        {
            ChangeLogSet changeLog =
                getChangeLog( changelogStream, streamDifferences, streamHistory, workspaceHistory, startDate, endDate );

            changeLog.setEndVersion( endVersion );
            changeLog.setStartVersion( startVersion );

            return new ChangeLogScmResult( accurev.getCommandLines(), changeLog );
        }
        else
        {
            return new ChangeLogScmResult( accurev.getCommandLines(), "AccuRev errors: " + errorMessage,
                                           accurev.getErrorOutput(), false );
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.maven.scm.provider.accurev.AccuRev

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.