Examples of PerforceScmProviderRepository


Examples of org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository

    private void testCommandLine( String scmUrl, String commandLine )
        throws Exception
    {
        ScmRepository repository = getScmManager().makeScmRepository( scmUrl );
        PerforceScmProviderRepository svnRepository =
            (PerforceScmProviderRepository) repository.getProviderRepository();
        ScmFileSet files =
            new ScmFileSet( new File( "." ),
                            Arrays.asList( new File[] { new File( "foo.xml" ), new File( "bar.xml" ) } ) );
        Commandline cl = PerforceRemoveCommand.createCommandLine( svnRepository, workingDirectory, files );
View Full Code Here

Examples of org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository

    private void testCommandLine( String commandLine )
        throws Exception
    {

        ScmRepository repository = getScmManager().makeScmRepository( "scm:perforce://depot/projects/pathname" );
        PerforceScmProviderRepository svnRepository = (PerforceScmProviderRepository) repository
            .getProviderRepository();
        Commandline cl = PerforceStatusCommand.createOpenedCommandLine( svnRepository, workingDirectory,
                                                                        "//depot/projects/pathname" );

        assertCommandLine( commandLine, null, cl );
View Full Code Here

Examples of org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository

    private void testCommandLine( String scmUrl, String commandLine )
        throws Exception
    {
        ScmRepository repository = getScmManager().makeScmRepository( scmUrl );
        PerforceScmProviderRepository svnRepository =
            (PerforceScmProviderRepository) repository.getProviderRepository();
        ScmFileSet files =
            new ScmFileSet( new File( "." ),
                            Arrays.asList( new File[] { new File( "foo.xml" ), new File( "bar.xml" ) } ) );
        Commandline cl = PerforceAddCommand.createCommandLine( svnRepository, workingDirectory, files );
View Full Code Here

Examples of org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository

    private void testCommandLine( String scmUrl, String commandLine, ScmFileSet files )
        throws Exception
    {
        ScmRepository repository = getScmManager().makeScmRepository( scmUrl );
        PerforceScmProviderRepository svnRepository =
            (PerforceScmProviderRepository) repository.getProviderRepository();
        Commandline cl = PerforceCheckInCommand.createCommandLine( svnRepository, workingDirectory );

        assertCommandLine( commandLine, null, cl );
View Full Code Here

Examples of org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository

            user = path.substring( 0, path.indexOf( '@' ) );
            path = path.substring( path.indexOf( '@' ) + 1 );
        }

        return new PerforceScmProviderRepository( protocol, host, port, path, user, password );
    }
View Full Code Here

Examples of org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository

    /** {@inheritDoc} */
    protected StatusScmResult executeStatusCommand( ScmProviderRepository repo, ScmFileSet files )
        throws ScmException
    {
        PerforceScmProviderRepository prepo = (PerforceScmProviderRepository) repo;
        actualLocation = PerforceScmProvider.getRepoPath( getLogger(), prepo, files.getBasedir() );
        PerforceStatusConsumer consumer = new PerforceStatusConsumer();
        Commandline command = readOpened( prepo, files, consumer );

        if ( consumer.isSuccess() )
View Full Code Here

Examples of org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository

     */
    protected CheckOutScmResult executeCheckOutCommand( ScmProviderRepository repo, ScmFileSet files,
                                                        ScmVersion version, boolean recursive )
        throws ScmException
    {
        PerforceScmProviderRepository prepo = (PerforceScmProviderRepository) repo;
        File workingDirectory = new File( files.getBasedir().getAbsolutePath() );

        actualLocation = PerforceScmProvider.getRepoPath( getLogger(), prepo, files.getBasedir() );

        String specname = PerforceScmProvider.getClientspecName( getLogger(), prepo, workingDirectory );
        PerforceCheckOutConsumer consumer = new PerforceCheckOutConsumer( specname, actualLocation );
        if ( getLogger().isInfoEnabled() )
        {
            getLogger().info( "Checkout working directory: " + workingDirectory );
        }
        Commandline cl = null;

        // Create or update a clientspec so we can checkout the code to a particular location
        try
        {
            // Ahhh, glorious Perforce.  Create and update of clientspecs is the exact
            // same operation so we don't need to distinguish between the two modes.
            cl = PerforceScmProvider.createP4Command( prepo, workingDirectory );
            cl.createArg().setValue( "client" );
            cl.createArg().setValue( "-i" );
            if ( getLogger().isInfoEnabled() )
            {
                getLogger().info( "Executing: " + PerforceScmProvider.clean( cl.toString() ) );
            }

            String client =
                PerforceScmProvider.createClientspec( getLogger(), prepo, workingDirectory, actualLocation );

            if ( getLogger().isDebugEnabled() )
            {
                getLogger().debug( "Updating clientspec:\n" + client );
            }

            CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
            int exitCode =
                CommandLineUtils.executeCommandLine( cl, new ByteArrayInputStream( client.getBytes() ), consumer, err );

            if ( exitCode != 0 )
            {
                String cmdLine = CommandLineUtils.toString( cl.getCommandline() );

                StringBuilder msg = new StringBuilder( "Exit code: " + exitCode + " - " + err.getOutput() );
                msg.append( '\n' );
                msg.append( "Command line was:" + cmdLine );

                throw new CommandLineException( msg.toString() );
            }
        }
        catch ( CommandLineException e )
        {
            if ( getLogger().isErrorEnabled() )
            {
                getLogger().error( "CommandLineException " + e.getMessage(), e );
            }
        }

        boolean clientspecExists = consumer.isSuccess();

        // Perform the actual checkout using that clientspec
        try
        {
            if ( clientspecExists )
            {
                try
                {
                    getLastChangelist( prepo, workingDirectory, specname );
                    cl = createCommandLine( prepo, workingDirectory, version, specname );
                    if ( getLogger().isDebugEnabled() )
                    {
                        getLogger().debug( "Executing: " + PerforceScmProvider.clean( cl.toString() ) );
                    }
                    Process proc = cl.execute();
                    BufferedReader br = new BufferedReader( new InputStreamReader( proc.getInputStream() ) );
                    String line;
                    while ( ( line = br.readLine() ) != null )
                    {
                        if ( getLogger().isDebugEnabled() )
                        {
                            getLogger().debug( "Consuming: " + line );
                        }
                        consumer.consumeLine( line );
                    }
                    CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
                    int exitCode = CommandLineUtils.executeCommandLine( cl, consumer, err );

                    if ( exitCode != 0 )
                    {
                        String cmdLine = CommandLineUtils.toString( cl.getCommandline() );

                        StringBuilder msg = new StringBuilder( "Exit code: " + exitCode + " - " + err.getOutput() );
                        msg.append( '\n' );
                        msg.append( "Command line was:" + cmdLine );

                        throw new CommandLineException( msg.toString() );
                    }
                    if ( getLogger().isDebugEnabled() )
                    {
                        getLogger().debug( "Perforce sync complete." );
                    }
                }
                catch ( CommandLineException e )
                {
                    if ( getLogger().isErrorEnabled() )
                    {
                        getLogger().error( "CommandLineException " + e.getMessage(), e );
                    }
                }
                catch ( IOException e )
                {
                    if ( getLogger().isErrorEnabled() )
                    {
                        getLogger().error( "IOException " + e.getMessage(), e );
                    }
                }
            }

            if ( consumer.isSuccess() )
            {
                return new CheckOutScmResult( cl.toString(), consumer.getCheckedout() );
            }
            else
            {
                return new CheckOutScmResult( cl.toString(), "Unable to sync.  Are you logged in?",
                                              consumer.getOutput(), consumer.isSuccess() );
            }
        }
        finally
        {
            // See SCM-113
            // Support transient clientspecs as we don't want to create 1000s of permanent clientspecs
            if ( clientspecExists && !prepo.isPersistCheckout() )
            {
                // Delete the clientspec
                InputStreamReader isReader = null;
                InputStreamReader isReaderErr = null;
                try
View Full Code Here

Examples of org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository

            user = path.substring( 0, path.indexOf( '@' ) );
            path = path.substring( path.indexOf( '@' ) + 1 );
        }

        return new PerforceScmProviderRepository( protocol, host, port, path, user, password );
    }
View Full Code Here

Examples of org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository

        {
            return new UpdateScmResult( cosr.getCommandLine(), cosr.getProviderMessage(), cosr.getCommandOutput(),
                                        false );
        }

        PerforceScmProviderRepository p4repo = (PerforceScmProviderRepository) repo;
        String clientspec = PerforceScmProvider.getClientspecName( getLogger(), p4repo, files.getBasedir() );
        Commandline cl = createCommandLine( p4repo, files.getBasedir(), clientspec );

        @SuppressWarnings( "unused" )
        String location = PerforceScmProvider.getRepoPath( getLogger(), p4repo, files.getBasedir() );
View Full Code Here

Examples of org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository

    public BlameScmResult executeBlameCommand( ScmProviderRepository repo, ScmFileSet workingDirectory,
                                               String filename )
        throws ScmException
    {
        // Call annotate command
        PerforceScmProviderRepository p4repo = (PerforceScmProviderRepository) repo;
        String clientspec = PerforceScmProvider.getClientspecName( getLogger(), p4repo, workingDirectory.getBasedir() );
        Commandline cl =
            createCommandLine( (PerforceScmProviderRepository) repo, workingDirectory.getBasedir(), filename,
                               clientspec );
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.