Examples of BranchScmResult


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

            ScmFile f = i.next();

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

        return new BranchScmResult( fileList, result );
    }
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

        {
            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

                                                              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

    public void testBranchCommandTest()
        throws Exception
    {
        String branch = "test-branch";

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

        assertResultIsSuccess( branchResult );

        assertEquals( "check all 4 files branched", 4, branchResult.getBranchedFiles().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.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
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.