Package org.apache.maven.scm.command.tag

Examples of org.apache.maven.scm.command.tag.TagScmResult


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

        try
        {
            CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
            CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();

            int exitCode;

            Commandline clTag = createCommandLine( repository, fileSet.getBasedir(), tag, messageFile );

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

            if ( repo.isPushChanges() )
            {
                // and now push the tag to the configured upstream repository
                Commandline clPush = createPushCommandLine( repository, fileSet, tag );
   
                exitCode = GitCommandLineUtils.execute( clPush, stdout, stderr, getLogger() );
                if ( exitCode != 0 )
                {
                    return new TagScmResult( clPush.toString(), "The git-push command failed.", stderr.getOutput(),
                                             false );
                }
            }
           
            // plus search for the tagged 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 CheckOutScmResult( clList.toString(), "The git-ls-files command failed.",
                                              stderr.getOutput(), false );
            }

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


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

        Commandline cl = createCommandLine( repository, fileSet.getBasedir(), tag, messageFile, scmTagParameters );

        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 )
        {
            // TODO: Improve this error message
            return new TagScmResult( cl.toString(), "The svn tag command failed.", stderr.getOutput(), false );
        }

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

        List<File> files = null;

        try
        {
            if ( StringUtils.isNotEmpty( fileSet.getExcludes() ) )
            {
                @SuppressWarnings( "unchecked" )
                List<File> list =
                    FileUtils.getFiles( fileSet.getBasedir(),
                                        ( StringUtils.isEmpty( fileSet.getIncludes() ) ? "**"
                                                        : fileSet.getIncludes() ), fileSet.getExcludes()
                                            + ",**/.svn/**", false );
                files = list;
            }
            else
            {
                @SuppressWarnings( "unchecked" )
                List<File> list =
                    FileUtils.getFiles( fileSet.getBasedir(),
                                        ( StringUtils.isEmpty( fileSet.getIncludes() ) ? "**"
                                                        : fileSet.getIncludes() ), "**/.svn/**", false );
                files = list;
            }
        }
        catch ( IOException e )
        {
            throw new ScmException( "Error while executing command.", e );
        }

        for ( Iterator<File> i = files.iterator(); i.hasNext(); )
        {
            File f = i.next();

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

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

        List<ScmFile> files = new ArrayList<ScmFile>( fileSet.getFileList().size() );
        for ( File f : fileSet.getFileList() )
        {
            files.add( new ScmFile( f.getPath(), ScmFileStatus.TAGGED ) );
        }
        return new TagScmResult( "", files );
    }
View Full Code Here

        BazaarConsumer consumer = new BazaarConsumer( getLogger() );
        String[] tagCmd = new String[] { BazaarConstants.TAG_CMD, tagName };
        ScmResult tagResult = BazaarUtils.execute( consumer, getLogger(), bazaarRoot, tagCmd );
        if ( !tagResult.isSuccess() )
        {
            return new TagScmResult( null, tagResult );
        }

        // Do "bzr ls -R -r tag:tagName" to get a list of the tagged files
        BazaarLsConsumer lsConsumer = new BazaarLsConsumer( getLogger(), bazaarRoot, ScmFileStatus.TAGGED );
        String[] lsCmd = new String[] {
                                       BazaarConstants.LS_CMD,
                                       BazaarConstants.RECURSIVE_OPTION,
                                       BazaarConstants.REVISION_OPTION,
                                       "tag:" + tagName
                                       };
        ScmResult lsResult = BazaarUtils.execute( lsConsumer, getLogger(), bazaarRoot, lsCmd );
        if ( !lsResult.isSuccess() )
        {
            return new TagScmResult( null, lsResult );
        }

        // Push new tags to parent branch if any
        BazaarScmProviderRepository bazaarRepository = (BazaarScmProviderRepository) repository;
        if ( !bazaarRepository.getURI().equals( fileSet.getBasedir().getAbsolutePath() ) && repository.isPushChanges() )
        {
            String[] pushCmd = new String[] { BazaarConstants.PUSH_CMD, bazaarRepository.getURI() };
            ScmResult pushResult =
                BazaarUtils.execute( new BazaarConsumer( getLogger() ), getLogger(), fileSet.getBasedir(), pushCmd );
            if ( !pushResult.isSuccess() )
            {
                return new TagScmResult( null, pushResult );
            }
        }

        return new TagScmResult( lsConsumer.getListedFiles(), tagResult );
    }
View Full Code Here

        ErrorStreamConsumer err = new ErrorStreamConsumer();

        int status = command.execute( out, err );
        if ( status != 0 || err.hasBeenFed() )
        {
            return new TagScmResult( command.getCommandString(), "Error code for TFS label command - " + status,
                                     err.getOutput(), false );
        }
        List<ScmFile> files = new ArrayList<ScmFile>( f.getFileList().size() );
        for ( File file : f.getFileList() )
        {
            files.add( new ScmFile( file.getPath(), ScmFileStatus.TAGGED ) );
        }
        return new TagScmResult( command.getCommandString(), files );

    }
View Full Code Here

        setDiffScmResult( new DiffScmResult( "", "", "", true ) );
        setEditScmResult( new EditScmResult( "", "", "", true ) );
        setExportScmResult( new ExportScmResult( "", "", "", true ) );
        setRemoveScmResult( new RemoveScmResult( "", "", "", true ) );
        setStatusScmResult( new StatusScmResult( "", "", "", true ) );
        setTagScmResult( new TagScmResult( "", "", "", true ) );
        setUnEditScmResult( new UnEditScmResult( "", "", "", true ) );
        setUpdateScmResult( new UpdateScmResult( "", "", "", true ) );
        setBlameScmResult( new BlameScmResult( "", "", "", true ) );
        setMkdirScmResult( new MkdirScmResult( "", "", "", true ) );
    }
View Full Code Here

        ScmProvider scmProviderMock = mock( ScmProvider.class );
        when( scmProviderMock.tag( isA( ScmRepository.class ),
                                   argThat( new IsScmFileSetEquals( fileSet ) ),
                                   eq( "release-label" ),
                                   argThat( new IsScmTagParamtersEquals( new ScmTagParameters( "[my prefix] copy for tag release-label" ) ) ) ) ).
                                   thenReturn( new TagScmResult( "...",
                                                                 Collections.singletonList( new ScmFile( getPath (rootProject
                                                                                                                  .getFile() ), ScmFileStatus.TAGGED ) ) ) );
        ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
        stub.setScmProvider( scmProviderMock );
View Full Code Here

        ScmProvider scmProviderMock = mock( ScmProvider.class );
        when( scmProviderMock.tag( eq( repository ),
                                   argThat(new IsScmFileSetEquals( fileSet ) ),
                                   eq( "release-label" ),
                                   argThat(new IsScmTagParamtersEquals( new ScmTagParameters( "[my prefix] copy for tag release-label" ) ) ) ) ).
                                       thenReturnnew TagScmResult( "...", Collections.singletonList( new ScmFile( getPath (rootProject
                                                                                                                              .getFile() ), ScmFileStatus.TAGGED ) ) ) ) ;

        ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
        stub.setScmProvider( scmProviderMock );
        stub.addScmRepositoryForUrl( scmUrl, repository );
View Full Code Here

        ScmProvider scmProviderMock = mock( ScmProvider.class );
        when( scmProviderMock.tag( eq( repository ),
                                   argThat( new IsScmFileSetEquals( fileSet ) ),
                                   eq( "release-label" ),
                                   argThat( new IsScmTagParamtersEquals( new ScmTagParameters(
                                           "[my prefix] copy for tag release-label" ) ) ) ) ).thenReturn( new TagScmResult(
                                                "...",
                                                Collections.singletonList( new ScmFile(
                                                                                        getPath( rootProject.getFile() ),
                                                                                        ScmFileStatus.TAGGED ) ) ) );
View Full Code Here

        ScmProvider scmProviderMock = mock( ScmProvider.class );
        when( scmProviderMock.tag( isA( ScmRepository.class ),
                                   argThat( new IsScmFileSetEquals( fileSet ) ),
                                   eq( "release-label" ),
                                   argThat( new IsScmTagParamtersEquals( new ScmTagParameters( "[my prefix] copy for tag release-label" ) ) ) ) ).thenReturn( new TagScmResult( "...", Collections.singletonList( new ScmFile( getPath( rootProject
                       .getFile() ), ScmFileStatus.TAGGED ) ) ) );

        ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
        stub.setScmProvider( scmProviderMock );
View Full Code Here

TOP

Related Classes of org.apache.maven.scm.command.tag.TagScmResult

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.