Package org.apache.maven.scm

Examples of org.apache.maven.scm.ScmResult


        {
            Project.validateTag( branchName );
            Response res = siProject.createDevPath( branchName );
            int exitCode = res.getExitCode();
            boolean success = ( exitCode == 0 ? true : false );
            ScmResult scmResult = new ScmResult( res.getCommandString(), "", "Exit Code: " + exitCode, success );
            result = new BranchScmResult( new ArrayList<ScmFile>(), scmResult );
        }
        catch ( APIException aex )
        {
            ExceptionHandler eh = new ExceptionHandler( aex );
View Full Code Here


            return new AddScmResult( "si add", addedFiles );
        }
        else
        {
            return new AddScmResult( addedFiles,
                                     new ScmResult( "si add", "There was a problem adding files to the repository", "",
                                                    false ) );
        }
    }
View Full Code Here

        {
            getLogger().debug( "Executing: " + shell.getCommandline() );
            int exitCode = CommandLineUtils.executeCommandLine( shell, shellConsumer,
                                                                new CommandLineUtils.StringStreamConsumer() );
            boolean success = ( exitCode == 128 ? false : true );
            ScmResult scmResult =
                new ScmResult( shell.getCommandline().toString(), "", "Exit Code: " + exitCode, success );
            // Since we can't really parse the differences output, we'll just have to go by the command output
            // Returning a DiffScmResult(List changedFiles, Map differences, String patch, ScmResult result) to avoid an NPE
            // in org.codehaus.plexus.util.FileUtils.fileWrite(FileUtils.java:426)
            return new DiffScmResult( new ArrayList<ScmFile>(), new HashMap<String, CharSequence>(), "", scmResult );
View Full Code Here

            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 ) );
                }
            }
        }

        // do an inventory to return the files branched (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() )
        {
            throw new ScmException( "Error while executing command " + joinCmd(listCmd) );
        }

        List<ScmFile> files = listconsumer.getFiles();
View Full Code Here

            if ( scmFileList.size() == 0 )
            {
                getLogger().info( "No local changes found!" );
            }
            result = new StatusScmResult( scmFileList, new ScmResult( "si viewsandbox", "", "", true ) );
        }
        catch ( APIException aex )
        {
            ExceptionHandler eh = new ExceptionHandler( aex );
            getLogger().error( "MKS API Exception: " + eh.getMessage() );
View Full Code Here

        if ( null == filename || filename.length() == 0 )
        {
            throw new ScmException( "A single filename is required to execute the lock command!" );
        }

        ScmResult result;
        IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
        try
        {
            Sandbox siSandbox = iRepo.getSandbox();
            File memberFile = new File( workingDirectory.getAbsoluteFile() + File.separator + filename );
            Response res = siSandbox.lock( memberFile, filename );
            int exitCode = res.getExitCode();
            boolean success = ( exitCode == 0 ? true : false );
            result = 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 ScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false );
        }

        return result;
    }
View Full Code Here

        }

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

        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 );
        ScmResult result = HgUtils.execute( consumer, getLogger(), checkoutDir, inventoryCmd );

        return new CheckOutScmResult( consumer.getCheckedOutFiles(), result );
    }
View Full Code Here

        String[] cmd = new String[]{ BLAME_CMD, "--user",   // list the author
            "--date",   // list the date
            "--changeset", // list the global revision number
            filename };
        HgBlameConsumer consumer = new HgBlameConsumer( getLogger() );
        ScmResult result = HgUtils.execute( consumer, getLogger(), workingDirectory.getBasedir(), cmd );
        return new BlameScmResult( consumer.getLines(), result );
    }
View Full Code Here

        command = HgUtils.expandCommandLine( command, fileSet );

        File workingDir = fileSet.getBasedir();
        HgRemoveConsumer consumer = new HgRemoveConsumer( getLogger(), workingDir );

        ScmResult result = HgUtils.execute( consumer, getLogger(), workingDir, command );
        return new RemoveScmResult( consumer.getRemovedFiles(), result );
    }
View Full Code Here

TOP

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

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.