Examples of HgConsumer


Examples of org.apache.maven.scm.provider.hg.command.HgConsumer

    public static ScmResult execute( File workingDir, String[] cmdAndArgs )
        throws ScmException
    {
        ScmLogger logger = new DefaultLog();
        return execute( new HgConsumer( logger ), logger, workingDir, cmdAndArgs );
    }
View Full Code Here

Examples of org.apache.maven.scm.provider.hg.command.HgConsumer

    public static ScmResult execute( File workingDir, String[] cmdAndArgs )
        throws ScmException
    {
        ScmLogger logger = new DefaultLog();
        return execute( new HgConsumer( logger ), logger, workingDir, cmdAndArgs );
    }
View Full Code Here

Examples of org.apache.maven.scm.provider.hg.command.HgConsumer

                    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
        {
View Full Code Here

Examples of org.apache.maven.scm.provider.hg.command.HgConsumer

        String[] branchCmd =
            new String[]{ HgCommandConstants.BRANCH_CMD, branch };

        // keep the command about in string form for reporting
        ;
        HgConsumer branchConsumer = new HgConsumer( getLogger() ) {
            public void doConsume( ScmFileStatus status, String trimmedLine )
            {
            }
        };

        ScmResult result = HgUtils.execute( branchConsumer, getLogger(), workingDir, branchCmd );
        HgScmProviderRepository repository = (HgScmProviderRepository) scmProviderRepository;

        if ( !result.isSuccess() )
        {
            throw new ScmException( "Error while executing command " + joinCmd( branchCmd ) );
        }

        // First commit.
        String[] commitCmd = new String[]{ HgCommandConstants.COMMIT_CMD, HgCommandConstants.MESSAGE_OPTION, scmBranchParameters.getMessage() };


        result = HgUtils.execute( new HgConsumer( getLogger() ), getLogger(), workingDir, commitCmd );

        if ( !result.isSuccess() )
        {
            throw new ScmException( "Error while executing command " + joinCmd( commitCmd ) );
        }

        // now push, if we should.

        if ( repository.isPushChanges() )
        {
            if ( !repository.getURI().equals( fileSet.getBasedir().getAbsolutePath() ) )
            {

                String[] pushCmd = new String[] {
                    HgCommandConstants.PUSH_CMD,
                    HgCommandConstants.NEW_BRANCH_OPTION,
                    repository.getURI()
                };

                result = HgUtils.execute( new HgConsumer( getLogger() ), getLogger(), fileSet.getBasedir(), pushCmd );

                if ( !result.isSuccess() )
                {
                    throw new ScmException( "Error while executing command " + joinCmd( pushCmd ) );
                }
View Full Code Here

Examples of org.apache.maven.scm.provider.hg.command.HgConsumer

        // Commit to local branch
        String[] commitCmd = new String[]{ HgCommandConstants.COMMIT_CMD, HgCommandConstants.MESSAGE_OPTION, message };
        commitCmd = HgUtils.expandCommandLine( commitCmd, fileSet );
        ScmResult result =
            HgUtils.execute( new HgConsumer( getLogger() ), getLogger(), fileSet.getBasedir(), commitCmd );

        // Push to parent branch if any
        HgScmProviderRepository repository = (HgScmProviderRepository) repo;

        if ( repo.isPushChanges() )
        {

            if ( !repository.getURI().equals( fileSet.getBasedir().getAbsolutePath() ) )
            {
                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 );
            }

            return new CheckInScmResult( commitedFiles, result );
        }
View Full Code Here

Examples of org.apache.maven.scm.provider.hg.command.HgConsumer

            cmdList.add( HgCommandConstants.CLEAN_OPTION );
        }
        cmdList.add( url );
        cmdList.add( checkoutDir.getAbsolutePath() );
        String[] checkoutCmd = cmdList.toArray( new String[0] );
        HgConsumer checkoutConsumer = new HgConsumer( getLogger() );
        HgUtils.execute( checkoutConsumer, getLogger(), checkoutDir.getParentFile(), checkoutCmd );

        // Do inventory to find list of checkedout files
        String[] inventoryCmd = new String[]{ HgCommandConstants.INVENTORY_CMD };
        HgCheckOutConsumer consumer = new HgCheckOutConsumer( getLogger(), checkoutDir );
View Full Code Here

Examples of org.apache.maven.scm.provider.hg.command.HgConsumer

                    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
        {
View Full Code Here

Examples of org.apache.maven.scm.provider.hg.command.HgConsumer

            updateCmd = new String[] {
                    HgCommandConstants.UPDATE_CMD,
                    tag != null && !StringUtils.isEmpty( tag.getName() ) ? tag.getName() : "tip",
                    HgCommandConstants.CLEAN_OPTION };
        }
        ScmResult updateResult = HgUtils.execute( new HgConsumer( getLogger() ), getLogger(), workingDir, updateCmd );

        if ( !updateResult.isSuccess() )
        {
            return new UpdateScmResult( null, null, updateResult );
        }

        // Find changes from last revision
        int currentRevision = HgUtils.getCurrentRevisionNumber( getLogger(), workingDir );
        int previousRevision = currentRevision - 1;
        String[] diffCmd = new String[] {
            HgCommandConstants.DIFF_CMD,
            HgCommandConstants.REVISION_OPTION,
            "" + previousRevision };
        HgDiffConsumer diffConsumer = new HgDiffConsumer( getLogger(), workingDir );
        ScmResult diffResult = HgUtils.execute( diffConsumer, getLogger(), workingDir, diffCmd );

        // Now translate between diff and update file status
        List<ScmFile> updatedFiles = new ArrayList<ScmFile>();
        List<CharSequence> changes = new ArrayList<CharSequence>();
        List<ScmFile> diffFiles = diffConsumer.getChangedFiles();
        Map<String, CharSequence> diffChanges = diffConsumer.getDifferences();
        for ( ScmFile file : diffFiles )
        {
            changes.add( diffChanges.get( file.getPath() ) );
            if ( file.getStatus() == ScmFileStatus.MODIFIED )
            {
                updatedFiles.add( new ScmFile( file.getPath(), ScmFileStatus.PATCHED ) );
            }
            else
            {
                updatedFiles.add( file );
            }
        }
       
        if ( repo.isPushChanges() ) {
          String[] hgUpdateCmd = new String[] { HgCommandConstants.UPDATE_CMD };
          HgUtils.execute( new HgConsumer( getLogger() ), getLogger(), workingDir, hgUpdateCmd );
        }

        return new UpdateScmResultWithRevision( updatedFiles, new ArrayList<ChangeSet>(0), String.valueOf( currentRevision ), diffResult );
    }
View Full Code Here

Examples of org.apache.maven.scm.provider.hg.command.HgConsumer

    public static ScmResult execute( File workingDir, String[] cmdAndArgs )
        throws ScmException
    {
        ScmLogger logger = new DefaultLog();
        return execute( new HgConsumer( logger ), logger, workingDir, cmdAndArgs );
    }
View Full Code Here

Examples of org.apache.maven.scm.provider.hg.command.HgConsumer

        // Commit to local branch
        String[] commitCmd = new String[]{ HgCommandConstants.COMMIT_CMD, HgCommandConstants.MESSAGE_OPTION, message };
        commitCmd = HgUtils.expandCommandLine( commitCmd, fileSet );
        ScmResult result =
            HgUtils.execute( new HgConsumer( getLogger() ), getLogger(), fileSet.getBasedir(), commitCmd );

        // Push to parent branch if any
        HgScmProviderRepository repository = (HgScmProviderRepository) repo;

        if ( repo.isPushChanges() )
        {

            if ( !repository.getURI().equals( fileSet.getBasedir().getAbsolutePath() ) )
            {
                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 );
            }

            return new CheckInScmResult( commitedFiles, result );
        }
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.