Examples of GitStatusConsumer


Examples of org.apache.maven.scm.provider.git.gitexe.command.status.GitStatusConsumer

            // git-commit 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() );
            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)" );
                }
            }
           
            if ( statusConsumer.getChangedFiles().isEmpty() )
            {
                return new CheckInScmResult( null, statusConsumer.getChangedFiles() );
            }

            Commandline clCommit = createCommitCommandLine( repository, fileSet, messageFile );

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

            if( repo.isPushChanges() )
            {
                Commandline cl = createPushCommandLine( getLogger(), repository, fileSet, version );

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

            List<ScmFile> checkedInFiles = new ArrayList<ScmFile>( statusConsumer.getChangedFiles().size() );

            // rewrite all detected files to now have status 'checked_in'
            for ( Iterator<ScmFile> it = statusConsumer.getChangedFiles().iterator(); it.hasNext(); )
            {
                ScmFile scmfile = new ScmFile( it.next().getPath(), ScmFileStatus.CHECKED_IN );

                if ( fileSet.getFileList().isEmpty() )
                {
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.