Package org.apache.maven.scm.command.checkout

Examples of org.apache.maven.scm.command.checkout.CheckOutScmResult


        ScmManager scmManager = (ScmManager) lookup( ScmManager.ROLE );
        ScmProviderStub providerStub =
            (ScmProviderStub) scmManager.getProviderByUrl( releaseDescriptor.getScmSourceUrl() );

        providerStub.setCheckOutScmResult( new CheckOutScmResult( "", "", "", false ) );

        try
        {
            releaseManager.perform( releaseDescriptor, new DefaultReleaseEnvironment(), createReactorProjects() );
View Full Code Here


        // TODO: probably need to base this from a working directory in the main configuration
        File workingDirectory = configuration.getWorkingDirectory();

        ScmRepository repository = getScmRepository( configuration );

        CheckOutScmResult result;

        // TODO: synchronizing *all* checkouts is unnecessary
        synchronized ( this )
        {
            if ( !workingDirectory.exists() )
View Full Code Here

            String tag = config.getTag();
            getLogger().info(
                "Checking out project: '" + project.getName() + "', id: '" + project.getId() + "' " + "to '" +
                    workingDirectory + "'" + ( tag != null ? " with branch/tag " + tag + "." : "." ) );

            CheckOutScmResult checkoutResult = scm.checkout( config );
            if ( StringUtils.isNotEmpty( checkoutResult.getRelativePathProjectDirectory() ) )
            {
                setProjectRelativePath( context, checkoutResult.getRelativePathProjectDirectory() );
            }

            if ( !checkoutResult.isSuccess() )
            {
                // TODO: is it more appropriate to return this in the converted result so that it can be presented to
                // the user?
                String msg = "Error while checking out the code for project: '" + project.getName() + "', id: '" +
                    project.getId() + "' to '" + workingDirectory.getAbsolutePath() + "'" +
                    ( tag != null ? " with branch/tag " + tag + "." : "." );
                getLogger().warn( msg );

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

                getLogger().warn( "Provider message: " + checkoutResult.getProviderMessage() );
            }
            else
            {
                getLogger().info( "Checked out " + checkoutResult.getCheckedOutFiles().size() + " files." );
            }

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

            String tag = config.getTag();
            getLogger().info(
                "Checking out project: '" + project.getName() + "', id: '" + project.getId() + "' " + "to '" +
                    workingDirectory + "'" + ( tag != null ? " with branch/tag " + tag + "." : "." ) );

            CheckOutScmResult checkoutResult = scm.checkout( config );
            //if ( StringUtils.isNotEmpty( checkoutResult.getRelativePathProjectDirectory() ) )
            //{
            //    context.put( AbstractContinuumAction.KEY_PROJECT_RELATIVE_PATH,
            //                 checkoutResult.getRelativePathProjectDirectory() );
            //}

            if ( !checkoutResult.isSuccess() )
            {
                // TODO: is it more appropriate to return this in the converted result so that it can be presented to
                // the user?
                String msg = "Error while checking out the code for project: '" + project.getName() + "', id: '" +
                    project.getId() + "' to '" + workingDirectory.getAbsolutePath() + "'" +
                    ( tag != null ? " with branch/tag " + tag + "." : "." );
                getLogger().warn( msg );

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

                getLogger().warn( "Provider message: " + checkoutResult.getProviderMessage() );
            }
            else
            {
                getLogger().info( "Checked out " + checkoutResult.getCheckedOutFiles().size() + " files." );
            }

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

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

        UpdateScmResult updateScmResult = null;
        CheckOutScmResult checkOutScmResult = null;

        File workingDirectory = new File( releaseDescriptor.getWorkingDirectory() );
        ScmFileSet workingDirSet = new ScmFileSet( workingDirectory );

        try
        {
            if ( !workingDirectory.exists() )
            {
                workingDirectory.mkdirs();
            }

            ScmVersion scmTag = null;

            ScmProviderRepository providerRepo = repository.getProviderRepository();

            // FIXME: This should be handled by the maven-scm git provider
            if ( providerRepo instanceof GitScmProviderRepository )
            {
                String branchName = GitBranchCommand.getCurrentBranch( new PlexusLogger( getLogger() ),
                                                                       (GitScmProviderRepository) providerRepo,
                                                                       workingDirSet );
                scmTag = new ScmBranch( branchName );
            }

            if ( workingDirectory.listFiles().length > 1 )
            {
                updateScmResult = provider.update( repository, workingDirSet, scmTag );
            }
            else
            {
                checkOutScmResult = provider.checkOut( repository, new ScmFileSet( workingDirectory ) );
                checkOutScmResult = provider.checkOut( repository, workingDirSet, scmTag );
            }
        }
        catch ( ScmException e )
        {
            throw new ReleaseExecutionException( "An error occurred while updating your local copy: " + e.getMessage(),
                                                 e );
        }

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

            copyUpdated = updateScmResult.getUpdatedFiles().size() > 0;
        }
        else
        {
            if ( !checkOutScmResult.isSuccess() )
            {
                throw new ReleaseScmCommandException( "Unable to checkout project", checkOutScmResult );
            }

            copyUpdated = checkOutScmResult.getCheckedOutFiles().size() > 0;
        }

        relResult.setResultCode( ReleaseResult.SUCCESS );

        return relResult;
View Full Code Here

                // Subversion is the only SCM that adds path structure to represent tags and branches.
                // The rest use scmVersion and scmVersionType.
                repoUrl += "/" + target.replace( '\\', '/' );
            }
            scmRepository = getScmRepository( repoUrl );
            CheckOutScmResult ret =
                scmProvider.checkOut( scmRepository, new ScmFileSet( new File( checkoutDirectory, "" ) ),
                                      makeScmVersion(), false );

            checkScmResult( ret );
        }
View Full Code Here

                }
            }

            if ( consumer.isSuccess() )
            {
                return new CheckOutScmResult( cl.toString(), consumer.getCheckedout() );
            }
            else
            {
                return new CheckOutScmResult( cl.toString(), "Unable to sync.  Are you logged in?",
                                              consumer.getOutput(), consumer.isSuccess() );
            }
        }
        finally
        {
View Full Code Here

            Commandline clList = GitListCommand.createCommandLine( repository, fileSet.getBasedir() );

            exitCode = GitCommandLineUtils.execute( clList, listConsumer, stderr, getLogger() );
            if ( exitCode != 0 )
            {
                return new CheckOutScmResult( clList.toString(), "The git-ls-files command failed.",
                                              stderr.getOutput(), false );
            }

            return new TagScmResult( clTag.toString(), listConsumer.getListedFiles() );
        }
View Full Code Here

    public void testCheckOutCommandTest()
        throws Exception
    {
        deleteDirectory( getWorkingCopy() );

        CheckOutScmResult result = checkOut( getWorkingCopy(), getScmRepository() );

        assertResultIsSuccess( result );

        List<ScmFile> checkedOutFiles = result.getCheckedOutFiles();

        if ( checkedOutFiles.size() != 4 )
        {
            SortedSet<ScmFile> files = new TreeSet<ScmFile>( checkedOutFiles );
View Full Code Here

     * Convenience method to check out files from the repository
     */
    protected CheckOutScmResult checkOut( File workingDirectory, ScmRepository repository )
        throws Exception
    {
        CheckOutScmResult result =
            getScmManager().getProviderByUrl( getScmUrl() ).checkOut( repository, new ScmFileSet( workingDirectory ),
                                                                      (ScmVersion) null );

        assertTrue( "Check result was successful, output: " + result.getCommandOutput(), result.isSuccess() );

        return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.scm.command.checkout.CheckOutScmResult

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.