Examples of MkdirScmResult


Examples of org.apache.maven.scm.command.mkdir.MkdirScmResult

        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

Examples of org.apache.maven.scm.command.mkdir.MkdirScmResult

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

        Commandline cl =
            createCommandLine( (SvnScmProviderRepository) repository, fileSet, messageFile, createInLocal );

        SvnMkdirConsumer consumer = new SvnMkdirConsumer( getLogger() );

        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, consumer, 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 MkdirScmResult( cl.toString(), "The svn command failed.", stderr.getOutput(), false );
        }

        if ( createInLocal )
        {
            return new MkdirScmResult( cl.toString(), consumer.getCreatedDirs() );
        }
        else
        {
            return new MkdirScmResult( cl.toString(), Integer.toString( consumer.getRevision() ) );
        }
    }
View Full Code Here

Examples of org.apache.maven.scm.command.mkdir.MkdirScmResult

        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

Examples of org.apache.maven.scm.command.mkdir.MkdirScmResult

        if ( null == dirPath || dirPath.length() == 0 )
        {
            throw new ScmException( "A relative directory path is required to execute this command!" );
        }
        getLogger().info( "Creating subprojects one per directory, as required for " + dirPath );
        MkdirScmResult result;
        IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
        try
        {
            Response res = iRepo.getSandbox().createSubproject( dirPath );
            String subProject = res.getWorkItems().next().getResult().getField( "resultant" ).getItem().getDisplayId();
            List<ScmFile> createdDirs = new ArrayList<ScmFile>();
            createdDirs.add( new ScmFile( subProject, ScmFileStatus.ADDED ) );
            int exitCode = res.getExitCode();
            boolean success = ( exitCode == 0 ? true : false );
            getLogger().info( "Successfully created subproject " + subProject );
            result = new MkdirScmResult( createdDirs,
                                         new ScmResult( res.getCommandString(), "", "Exit Code: " + exitCode,
                                                        success ) );
        }
        catch ( APIException aex )
        {
            ExceptionHandler eh = new ExceptionHandler( aex );
            getLogger().error( "MKS API Exception: " + eh.getMessage() );
            getLogger().info( eh.getCommand() + " exited with return code " + eh.getExitCode() );
            result = new MkdirScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false );
        }

        return result;
    }
View Full Code Here

Examples of org.apache.maven.scm.command.mkdir.MkdirScmResult

    public void testMkdirCommandMkdirLocal()
        throws Exception
    {
        ScmFileSet fileSet = new ScmFileSet( getWorkingCopy(), new File( getMissingDirectory() ) );

        MkdirScmResult result = getScmManager().mkdir( getScmRepository(), fileSet, null, true );

        assertResultIsSuccess( result );

        assertNotNull( result.getCreatedDirs() );

        assertTrue( "Directory should have been added.", 1 == result.getCreatedDirs().size() );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.mkdir.MkdirScmResult

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

        Commandline cl =
            createCommandLine( (SvnScmProviderRepository) repository, fileSet, messageFile, createInLocal );

        SvnMkdirConsumer consumer = new SvnMkdirConsumer( getLogger() );

        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, consumer, 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 MkdirScmResult( cl.toString(), "The svn command failed.", stderr.getOutput(), false );
        }

        if ( createInLocal )
        {
            return new MkdirScmResult( cl.toString(), consumer.getCreatedDirs() );
        }
        else
        {
            return new MkdirScmResult( cl.toString(), Integer.toString( consumer.getRevision() ) );
        }
    }
View Full Code Here

Examples of org.apache.maven.scm.command.mkdir.MkdirScmResult

            File modulePath = new File( repo.getRoot(), repo.getModule() );
            File dir = new File( modulePath, file.getName() );

            if ( dir.exists() )
            {
                return new MkdirScmResult( null, "Directory already exists!", "Directory already exists.", false );
            }
            else
            {
                if ( getLogger().isInfoEnabled() )
                {
                    getLogger().info( "Creating directory in '" + modulePath.getAbsolutePath() + "'" );
                }

                FileUtils.mkdir( dir.getAbsolutePath() );
                createdDirs.add( new ScmFile( dir.getPath(), ScmFileStatus.ADDED ) );
            }
        }
        else
        {
            // add the directory, but not commit
            LocalAddCommand addCmd = new LocalAddCommand();
            addCmd.setLogger( getLogger() );

            CommandParameters parameters = new CommandParameters();
            parameters.setString( CommandParameter.MESSAGE, message );
            parameters.setString( CommandParameter.BINARY, "false" );

            String path = ( (File) fileSet.getFileList().get( 0 ) ).getPath();
            if ( repo.isFileAdded( path ) )
            {
                return new MkdirScmResult( null, "Directory already exists!", "Directory already exists.", false );
            }

            AddScmResult result = (AddScmResult) addCmd.execute( repository, fileSet, parameters );
            createdDirs.addAll( result.getAddedFiles() );
        }

        return new MkdirScmResult( null, createdDirs );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.mkdir.MkdirScmResult

    public void testMkdirCommandMkdirUrl()
        throws Exception
    {
        ScmFileSet fileSet = new ScmFileSet( getWorkingCopy(), new File( getMissingDirectory() ) );

        MkdirScmResult result = getScmManager().mkdir( getScmRepository(), fileSet, "Mkdir message", false );

        assertResultIsSuccess( result );

        ListScmResult listResult = getScmManager().list( getScmRepository(), fileSet, true, null );
View Full Code Here

Examples of org.apache.maven.scm.command.mkdir.MkdirScmResult

    public void testMkdirCommandDirAlreadyAdded()
        throws Exception
    {
        ScmFileSet fileSet = new ScmFileSet( getWorkingCopy(), new File( getMissingDirectory() ) );

        MkdirScmResult result = getScmManager().mkdir( getScmRepository(), fileSet, "Mkdir message", false );

        assertResultIsSuccess( result );

        ListScmResult listResult = getScmManager().list( getScmRepository(), fileSet, true, null );

        assertTrue( "Directory should have been found.", listResult.isSuccess() );

        // add the directory again
        result = getScmManager().mkdir( getScmRepository(), fileSet, "Mkdir message", false );

        assertFalse( result.isSuccess() );

        printOutputError( result );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.mkdir.MkdirScmResult

        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
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.