Package org.apache.maven.scm

Examples of org.apache.maven.scm.ScmResult


        {
            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 );
            return new BlameScmResult( shellConsumer.getBlameList(), scmResult );
        }
        catch ( CommandLineException cle )
        {
            getLogger().error( "Command Line Exception: " + cle.getMessage() );
View Full Code Here


                tag };

        // keep the command about in string form for reporting
        StringBuilder cmd = joinCmd( tagCmd );
        HgTagConsumer consumer = new HgTagConsumer( getLogger() );
        ScmResult result = HgUtils.execute( consumer, getLogger(), workingDir, tagCmd );
        HgScmProviderRepository repository = (HgScmProviderRepository) scmProviderRepository;
        if ( result.isSuccess() )
        {
            // now push
            // Push to parent branch if any

            if ( repository.isPushChanges() )
            {
                if ( !repository.getURI().equals( fileSet.getBasedir().getAbsolutePath() ) )
                {
                    String branchName = HgUtils.getCurrentBranchName( getLogger(), workingDir );
                    boolean differentOutgoingBranch =
                        HgUtils.differentOutgoingBranchFound( getLogger(), workingDir, branchName );

                    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
        {
            throw new ScmException( "Error while executing command " + cmd.toString() );
        }

        // do an inventory to return the files tagged (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() )
        {
            List<ScmFile> files = listconsumer.getFiles();
            List<ScmFile> fileList = new ArrayList<ScmFile>();
            for ( ScmFile f : files )
            {
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

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

            for ( Iterator<Member> it = projectMembers.iterator(); it.hasNext(); )
            {
                Member siMember = it.next();
                scmFileList.add( new ScmFile( siMember.getTargetFilePath(), ScmFileStatus.UNKNOWN ) );
            }
            result = new ListScmResult( scmFileList, new ScmResult( "si viewproject", "", "", true ) );

        }
        catch ( APIException aex )
        {
            ExceptionHandler eh = new ExceptionHandler( aex );
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

            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().info( "Attempting to display scm file information for file: " + filename );
        if ( null == filename || filename.length() == 0 )
        {
            throw new ScmException( "A single filename is required to execute the fileinfo command!" );
        }
        ScmResult result;
        IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
        APISession api = iRepo.getAPISession();
        Commandline shell = new Commandline();
        shell.setWorkingDirectory( workingDirectory );
        shell.setExecutable( "si" );
        shell.createArg().setValue( "memberinfo" );
        shell.createArg().setValue( "--hostname=" + api.getHostName() );
        shell.createArg().setValue( "--port=" + api.getPort() );
        shell.createArg().setValue( "--user=" + api.getUserName() );
        shell.createArg().setValue( '"' + filename + '"' );
        IntegrityFileInfoConsumer shellConsumer = new IntegrityFileInfoConsumer( getLogger() );

        try
        {
            getLogger().debug( "Executing: " + shell.getCommandline() );
            int exitCode = CommandLineUtils.executeCommandLine( shell, shellConsumer,
                                                                new CommandLineUtils.StringStreamConsumer() );
            boolean success = ( exitCode == 128 ? false : true );
            result = new ScmResult( shell.getCommandline().toString(), "", "Exit Code: " + exitCode, success );

        }
        catch ( CommandLineException cle )
        {
            getLogger().error( "Command Line Exception: " + cle.getMessage() );
            result = new ScmResult( shell.getCommandline().toString(), cle.getMessage(), "", false );
        }

        return result;
    }
View Full Code Here

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

        ScmResult result;
        IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
        try
        {
            Sandbox siSandbox = iRepo.getSandbox();
            File memberFile = new File( workingDirectory.getAbsoluteFile() + File.separator + filename );
            Response res = siSandbox.unlock( 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

        {
            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
            // a 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

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.