Package org.apache.maven.scm

Examples of org.apache.maven.scm.ScmException


                                                      ScmVersion tag )
        throws ScmException
    {
        if ( tag != null && !StringUtils.isEmpty( tag.getName() ) )
        {
            throw new ScmException( "This provider can't handle tags for this operation" );
        }


        File workingDir = fileSet.getBasedir();
        String branchName = HgUtils.getCurrentBranchName( getLogger(), workingDir );
View Full Code Here


            }
            FileUtils.deleteDirectory( checkoutDir );
        }
        catch ( IOException e )
        {
            throw new ScmException( "Cannot remove " + checkoutDir );
        }

        // Do the actual checkout
        List<String> cmdList = new ArrayList<String>();
        if ( repo.isPushChanges() )
View Full Code Here

        {
            return new ListScmResult( consumer.getFiles(), result );
        }
        else
        {
            throw new ScmException( "Error while executing command " + cmd.toString() );
        }
    }
View Full Code Here

        throws ScmException
    {

        if ( tag == null || StringUtils.isEmpty( tag.trim() ) )
        {
            throw new ScmException( "tag must be specified" );
        }

        if ( !fileSet.getFileList().isEmpty() )
        {
            throw new ScmException( "This provider doesn't support tagging subsets of a directory : " + fileSet.getFileList() );
        }

        File workingDir = fileSet.getBasedir();

        // build the command
        String[] tagCmd =
            new String[]{ HgCommandConstants.TAG_CMD, HgCommandConstants.MESSAGE_OPTION, scmTagParameters.getMessage(),
                tag };

        // keep the command about in string form for reporting
        StringBuilder cmd = joinCmd( tagCmd );
        HgTagConsumer consumer = new HgTagConsumer( getLogger() );
        ScmResult result = HgUtils.execute( consumer, getLogger(), workingDir, tagCmd );
        HgScmProviderRepository repository = (HgScmProviderRepository) scmProviderRepository;
        if ( result.isSuccess() )
        {
            // now push
            // Push to parent branch if any

            if ( repository.isPushChanges() )
            {
                if ( !repository.getURI().equals( fileSet.getBasedir().getAbsolutePath() ) )
                {
                    String branchName = HgUtils.getCurrentBranchName( getLogger(), workingDir );
                    boolean differentOutgoingBranch =
                        HgUtils.differentOutgoingBranchFound( getLogger(), workingDir, branchName );

                    String[] pushCmd = new String[]{ HgCommandConstants.PUSH_CMD,
                        differentOutgoingBranch ? HgCommandConstants.REVISION_OPTION + branchName : null,
                        repository.getURI() };

                    result =
                        HgUtils.execute( new HgConsumer( getLogger() ), getLogger(), fileSet.getBasedir(), pushCmd );
                }
            }
        }
        else
        {
            throw new ScmException( "Error while executing command " + cmd.toString() );
        }

        // do an inventory to return the files tagged (all of them)
        String[] listCmd = new String[]{ HgCommandConstants.INVENTORY_CMD };
        HgListConsumer listconsumer = new HgListConsumer( getLogger() );
        result = HgUtils.execute( listconsumer, getLogger(), fileSet.getBasedir(), listCmd );
        if ( result.isSuccess() )
        {
            List<ScmFile> files = listconsumer.getFiles();
            List<ScmFile> fileList = new ArrayList<ScmFile>();
            for ( ScmFile f : files )
            {
                if ( !f.getPath().endsWith( ".hgtags" ) )
                {
                    fileList.add( new ScmFile( f.getPath(), ScmFileStatus.TAGGED ) );
                }
            }

            return new TagScmResult( fileList, result );
        }
        else
        {
            throw new ScmException( "Error while executing command " + cmd.toString() );
        }
    }
View Full Code Here

            ChangeSet hit = (ChangeSet) groupedEntries.get( cs.getDate() );
            if ( hit != null )
            {
                if ( cs.getFiles().size() != 1 )
                {
                    throw new ScmException( "Merge of entries failed. Bad entry size: " + cs.getFiles().size() );
                }
                hit.addFile( (ChangeFile) cs.getFiles().get( 0 ) );
            }
            else
            {
View Full Code Here

        GitRemoteInfoConsumer consumer = new GitRemoteInfoConsumer( getLogger(), clLsRemote.toString() );

        int exitCode = GitCommandLineUtils.execute( clLsRemote, consumer, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            throw new ScmException( "unbale to execute ls-remote on " + gitRepository.getFetchUrl() );
        }

        return consumer.getRemoteInfoScmResult();
    }
View Full Code Here

        {
            exitCode = SvnCommandLineUtils.execute( cl, consumer, stderr, getLogger() );
        }
        catch ( CommandLineException ex )
        {
            throw new ScmException( "Error while executing svn command.", ex );
        }

        if ( exitCode != 0 )
        {
            return new ChangeLogScmResult( cl.toString(), "The svn command failed.", stderr.getOutput(), false );
View Full Code Here

            tagsInfos = consumer.infos;

        }
        catch ( CommandLineException ex )
        {
            throw new ScmException( "Error while executing svn command.", ex );
        }

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

        cl = SvnCommandLineUtils.getBaseSvnCommandLine( fileSet == null ? null : fileSet.getBasedir(),
                                                        (SvnScmProviderRepository) repository );

        cl.createArg().setValue( "ls" );

        cl.createArg().setValue( baseUrl + "/tags" );

        stderr = new CommandLineUtils.StringStreamConsumer();

        consumer = new LsConsumer( getLogger(), baseUrl );

        Map<String, String> branchesInfos = null;

        try
        {
            exitCode = SvnCommandLineUtils.execute( cl, consumer, stderr, getLogger() );
            branchesInfos = consumer.infos;

        }
        catch ( CommandLineException ex )
        {
            throw new ScmException( "Error while executing svn command.", ex );
        }

        if ( exitCode != 0 )
        {
            return new RemoteInfoScmResult( cl.toString(), "The svn command failed.", stderr.getOutput(), false );
View Full Code Here

        {
            exitCode = SvnCommandLineUtils.execute( cl, consumer, stderr, getLogger() );
        }
        catch ( CommandLineException ex )
        {
            throw new ScmException( "Error while executing command.", ex );
        }

        if ( exitCode != 0 )
        {
            return new ExportScmResult( cl.toString(), "The svn command failed.", stderr.getOutput(), false );
View Full Code Here

        {
            exitCode = SvnCommandLineUtils.execute( cl, consumer, stderr, getLogger() );
        }
        catch ( CommandLineException ex )
        {
            throw new ScmException( "Error while executing svn command.", ex );
        }

        if ( exitCode != 0 )
        {
            String output = stderr.getOutput();
            //olamy: a bit ugly but....
            // trying to parse error from svn cli which indicate no remote path
            if ( output.indexOf( "W160013" ) >= 0 || output.indexOf( "svn: URL" ) >= 0 )
            {
                return false;
            }
            throw new ScmException( cl.toString() + ".The svn command failed:" + stderr.getOutput() );
        }

        return true;
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.scm.ScmException

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.