Examples of AddScmResult


Examples of org.apache.maven.scm.command.add.AddScmResult

                                                                      
        AccuRevAddCommand command = new AccuRevAddCommand( getLogger() );

        CommandParameters commandParameters = new CommandParameters();
        commandParameters.setString( CommandParameter.MESSAGE, "A new file" );
        AddScmResult result = command.add( repo, testFileSet, commandParameters );

        assertThat( result.isSuccess(), is( false ) );
        assertThat( result.getProviderMessage(), notNullValue() );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.add.AddScmResult

            {
                try
                {
                    ScmFileSet fileSet = new ScmFileSet( checkoutDirectory, relativized );
                    getLog().info( "scm add directory: " + relativized );
                    AddScmResult addDirResult = scmProvider.add( scmRepository, fileSet, "Adding directory" );
                    if ( !addDirResult.isSuccess() )
                    {
                        getLog().warn( " Error adding directory " + relativized + ": " + addDirResult.getCommandOutput() );
                    }
                }
                catch ( ScmException e )
                {
                    //
                }
            }
        }
        else
        { // add all directories in one command
            try
            {
                List<File> dirs = new ArrayList<File>( dirsToAdd );
                ScmFileSet fileSet = new ScmFileSet( checkoutDirectory, dirs );
                getLog().info( "scm add directories: " + dirs );
                AddScmResult addDirResult = scmProvider.add( scmRepository, fileSet, "Adding directories" );
                if ( !addDirResult.isSuccess() )
                {
                    getLog().warn( " Error adding directories " + dirs + ": " + addDirResult.getCommandOutput() );
                }
            }
            catch ( ScmException e )
            {
                //
View Full Code Here

Examples of org.apache.maven.scm.command.add.AddScmResult

            MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects );
            ScmFileSet scmFileSet = new ScmFileSet( rootProject.getFile().getParentFile(), releasePoms );

            try
            {
                AddScmResult scmResult = scmProvider.add( scmRepository, scmFileSet );

                if ( !scmResult.isSuccess() )
                {
                    throw new ReleaseScmCommandException( "Cannot add release POM to SCM", scmResult );
                }
            }
            catch ( ScmException exception )
View Full Code Here

Examples of org.apache.maven.scm.command.add.AddScmResult

        scmProviderMock
            .expects( new InvokeOnceMatcher() )
            .method( "add" )
            .with( arguments )
            .will( new ReturnStub( new AddScmResult( "...", Collections
                       .singletonList( new ScmFile( Maven.RELEASE_POMv4, ScmFileStatus.ADDED ) ) ) ) );

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

Examples of org.apache.maven.scm.command.add.AddScmResult

        File scmFile = new File( basedir, scmFilePath );

        if ( scmFilePath.length() != 0 )
        {
            AddScmResult result = scmProvider.add( scmRepository, new ScmFileSet( basedir, new File( scmFilePath ) ) );

            /*
             * TODO dirty fix to work around files with property svn:eol-style=native if a file has that property, first
             * time file is added it fails, second time it succeeds the solution is check if the scm provider is svn and
             * unset that property when the SCM API allows it
             */
            if ( !result.isSuccess() )
            {
                result = scmProvider.add( scmRepository, new ScmFileSet( basedir, new File( scmFilePath ) ) );
            }

            addedFiles = result.getAddedFiles().size();
        }

        String reservedScmFile = scmProvider.getScmSpecificFilename();

        if ( scmFile.isDirectory() )
View Full Code Here

Examples of org.apache.maven.scm.command.add.AddScmResult

        try
        {
            ScmRepository repository = getScmRepository();

            AddScmResult result = getScmManager().add( repository, getFileSet() );

            checkResult( result );

            getLog().info( "" + result.getAddedFiles().size() + " files successfully added." );

        }
        catch ( IOException e )
        {
            throw new MojoExecutionException( "Cannot run add command : ", e );
View Full Code Here

Examples of org.apache.maven.scm.command.add.AddScmResult

        if ( fileSet.getFileList().isEmpty() )
        {
            throw new ScmException( "You must provide at least one file/directory to add" );
        }

        AddScmResult result = executeAddFileSet( fileSet );

        if ( result != null )
        {
            return result;
        }
       
        // SCM-709: statusCommand uses repositoryRoot instead of workingDirectory, adjust it with relativeRepositoryPath
        Commandline clRevparse = GitStatusCommand.createRevparseShowToplevelCommand( fileSet );
       
        CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();

        URI relativeRepositoryPath = null;
       
        int exitCode;

        exitCode = GitCommandLineUtils.execute( clRevparse, stdout, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            // git-status returns non-zero if nothing to do
            if ( getLogger().isInfoEnabled() )
            {
                getLogger().info( "Could not resolve toplevel" );
            }
        }
        else
        {
            relativeRepositoryPath = GitStatusConsumer.resolveURI( stdout.getOutput().trim() , fileSet.getBasedir().toURI() );
        }

        // git-add doesn't show single files, but only summary :/
        // so we must run git-status and consume the output
        // borrow a few things from the git-status command
        Commandline clStatus = GitStatusCommand.createCommandLine( repository, fileSet );

        GitStatusConsumer statusConsumer = new GitStatusConsumer( getLogger(), fileSet.getBasedir(), relativeRepositoryPath );
        stderr = new CommandLineUtils.StringStreamConsumer();
        exitCode = GitCommandLineUtils.execute( clStatus, statusConsumer, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            // git-status returns non-zero if nothing to do
            if ( getLogger().isInfoEnabled() )
            {
                getLogger().info( "nothing added to commit but untracked files present (use \"git add\" to track)" );
            }
        }

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

        // rewrite all detected files to now have status 'checked_in'
        for ( ScmFile scmfile : statusConsumer.getChangedFiles() )
        {
            // if a specific fileSet is given, we have to check if the file is really tracked
            for ( File f : fileSet.getFileList() )
            {
                if ( FilenameUtils.separatorsToUnix( f.getPath() ).equals( scmfile.getPath() ) )
                {
                    changedFiles.add( scmfile );
                }
            }
        }

        Commandline cl = createCommandLine( fileSet.getBasedir(), fileSet.getFileList() );
        return new AddScmResult( cl.toString(), changedFiles );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.add.AddScmResult

        // command line can be too long for windows so add files individually (see SCM-697)
        if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
        {
            for ( File file : files )
            {
                AddScmResult result = executeAddFiles( workingDirectory, Collections.singletonList( file ) );

                if ( result != null )
                {
                    return result;
                }
            }
        }
        else
        {
            AddScmResult result = executeAddFiles( workingDirectory, files );

            if ( result != null )
            {
                return result;
            }
View Full Code Here

Examples of org.apache.maven.scm.command.add.AddScmResult

        int exitCode = GitCommandLineUtils.execute( cl, stdout, stderr, getLogger() );

        if ( exitCode != 0 )
        {
            return new AddScmResult( cl.toString(), "The git-add command failed.", stderr.getOutput(), false );
        }

        return null;
    }
View Full Code Here

Examples of org.apache.maven.scm.command.add.AddScmResult

        ScmProvider provider = getScmManager().getProviderByUrl( getScmUrl() );

        CommandParameters commandParameters = new CommandParameters();
        commandParameters.setString( CommandParameter.FORCE_ADD, Boolean.TRUE.toString() );

        AddScmResult result = provider.add( repository, new ScmFileSet( workingDirectory, file ), commandParameters );

        assertTrue( "Check result was successful, output: " + result.getCommandOutput(), result.isSuccess() );

        List<ScmFile> addedFiles = result.getAddedFiles();

        if ( new File( workingDirectory, file.getPath() ).isFile() )
        {
            // Don't check directory add because some SCM tools ignore it
            assertEquals( "Expected 1 file in the added files list " + addedFiles, 1, addedFiles.size() );
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.