Examples of BranchScmResult


Examples of org.apache.maven.scm.command.branch.BranchScmResult

        {
            FileUtils.fileWrite( messageFile.getAbsolutePath(), scmBranchParameters.getMessage() );
        }
        catch ( IOException ex )
        {
            return new BranchScmResult( null, "Error while making a temporary file for the commit message: "
                + ex.getMessage(), null, false );
        }

        Commandline cl = createCommandLine( repository, fileSet.getBasedir(), branch, messageFile, scmBranchParameters );

        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 )
        {
            return new BranchScmResult( cl.toString(), "The svn branch command failed.", stderr.getOutput(), false );
        }

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

        List<File> files = null;

        try
        {
            @SuppressWarnings( "unchecked" )
            List<File> listFiles = FileUtils.getFiles( fileSet.getBasedir(), "**", "**/.svn/**", false );
            files = listFiles;
        }
        catch ( IOException e )
        {
            throw new ScmException( "Error while executing command.", e );
        }

        for ( File f : files )
        {
            fileList.add( new ScmFile( f.getPath(), ScmFileStatus.TAGGED ) );
        }

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

Examples of org.apache.maven.scm.command.branch.BranchScmResult

     */
    public ScmProviderStub()
    {
        setScmSpecificFilename( "" );
        setAddScmResult( new AddScmResult( "", Collections.<ScmFile>emptyList() ) );
        setBranchScmResult( new BranchScmResult( "", Collections.<ScmFile>emptyList() ) );
        setChangeLogScmResult( new ChangeLogScmResult( "", "", "", true ) );
        setCheckInScmResult( new CheckInScmResult( "", "", "", true ) );
        setCheckOutScmResult( new CheckOutScmResult( "", "", "", true ) );
        setDiffScmResult( new DiffScmResult( "", "", "", true ) );
        setEditScmResult( new EditScmResult( "", "", "", true ) );
View Full Code Here

Examples of org.apache.maven.scm.command.branch.BranchScmResult

                                                              cl.getWorkingDirectory().getAbsolutePath(), logListener,
                                                              getLogger() );

            if ( !isSuccess )
            {
                return new BranchScmResult( cl.toString(), "The cvs branch command failed.",
                                            logListener.getStderr().toString(), false );
            }
            BufferedReader stream = new BufferedReader(
                new InputStreamReader( new ByteArrayInputStream( logListener.getStdout().toString().getBytes() ) ) );

            String line;

            while ( ( line = stream.readLine() ) != null )
            {
                consumer.consumeLine( line );
            }
        }
        catch ( Exception e )
        {
            getLogger().error( e.getMessage(), e );
            return new BranchScmResult( cl.toString(), "The cvs branch command failed.",
                                        logListener.getStderr().toString(), false );
        }

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

Examples of org.apache.maven.scm.command.branch.BranchScmResult

            throw new ScmException( "Error while executing command.", ex );
        }

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

        return new BranchScmResult( cl.toString(), consumer.getTaggedFiles() );

    }
View Full Code Here

Examples of org.apache.maven.scm.command.branch.BranchScmResult

        int exitCode;

        exitCode = GitCommandLineUtils.execute( cl, stdout, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            return new BranchScmResult( cl.toString(), "The git-branch command failed.", stderr.getOutput(), false );
        }

        if( repo.isPushChanges() )
        {
            // and now push the branch to the upstream repository
            Commandline clPush = createPushCommandLine( repository, fileSet, branch );

            exitCode = GitCommandLineUtils.execute( clPush, stdout, stderr, getLogger() );
            if ( exitCode != 0 )
            {
                return new BranchScmResult( clPush.toString(), "The git-push command failed.", stderr.getOutput(), false );
            }
        }

        // as last action we search for the branched files
        GitListConsumer listConsumer = new GitListConsumer( getLogger(), fileSet.getBasedir(), ScmFileStatus.TAGGED );

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

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

        return new BranchScmResult( cl.toString(), listConsumer.getListedFiles() );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.branch.BranchScmResult

            getLog().info( "Final Branch Name: '" + finalBranch + "'" );

            ScmBranchParameters scmBranchParameters = new ScmBranchParameters( message );
            scmBranchParameters.setRemoteBranching( remoteBranching );
           
            BranchScmResult result = provider.branch( repository, getFileSet(), finalBranch, scmBranchParameters );

            checkResult( result );
        }
        catch ( IOException e )
        {
View Full Code Here

Examples of org.apache.maven.scm.command.branch.BranchScmResult

        StringStreamConsumer out = new StringStreamConsumer();
        ErrorStreamConsumer err = new ErrorStreamConsumer();
        int status = command.execute( out, err );
        if ( status != 0 || err.hasBeenFed() )
        {
            return new BranchScmResult( command.getCommandString(), "Error code for TFS branch command - " + status,
                                        err.getOutput(), false );
        }
        return new BranchScmResult( command.getCommandString(), new ArrayList<ScmFile>( 0 ) );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.branch.BranchScmResult

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

        BranchScmResult result;
        try
        {
            ScmFileSet fileSet = new ScmFileSet( new File( releaseDescriptor.getWorkingDirectory() ) );
            String branchName = releaseDescriptor.getScmReleaseLabel();
           
            ScmBranchParameters scmBranchParameters = new ScmBranchParameters();
            scmBranchParameters.setMessage( releaseDescriptor.getScmCommentPrefix() + " copy for branch " + branchName );
            scmBranchParameters.setRemoteBranching( releaseDescriptor.isRemoteTagging() );
            scmBranchParameters.setScmRevision( releaseDescriptor.getScmReleasedPomRevision() );
           
            result = provider.branch( repository, fileSet, branchName, scmBranchParameters );
        }
        catch ( ScmException e )
        {
            throw new ReleaseExecutionException( "An error is occurred in the branch process: " + e.getMessage(), e );
        }

        if ( !result.isSuccess() )
        {
            throw new ReleaseScmCommandException( "Unable to branch SCM", result );
        }

        relResult.setResultCode( ReleaseResult.SUCCESS );
View Full Code Here

Examples of org.apache.maven.scm.command.branch.BranchScmResult

        int exitCode;

        exitCode = GitCommandLineUtils.execute( cl, stdout, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            return new BranchScmResult( cl.toString(), "The git-branch command failed.", stderr.getOutput(), false );
        }

        if( repo.isPushChanges() )
        {
            // and now push the branch to the upstream repository
            Commandline clPush = createPushCommandLine( repository, fileSet, branch );

            exitCode = GitCommandLineUtils.execute( clPush, stdout, stderr, getLogger() );
            if ( exitCode != 0 )
            {
                return new BranchScmResult( clPush.toString(), "The git-push command failed.", stderr.getOutput(), false );
            }
        }

        // as last action we search for the branched files
        GitListConsumer listConsumer = new GitListConsumer( getLogger(), fileSet.getBasedir(), ScmFileStatus.TAGGED );

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

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

        return new BranchScmResult( cl.toString(), listConsumer.getListedFiles() );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.branch.BranchScmResult

    public void testBranchCommandTest()
        throws Exception
    {
        String branch = getBranch();

        @SuppressWarnings( "deprecation" ) BranchScmResult branchResult =
            getScmManager().getProviderByUrl( getScmUrl() ).branch( getScmRepository(),
                                                                    new ScmFileSet( getWorkingCopy() ), branch );

        assertResultIsSuccess( branchResult );
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.