Examples of ScmProvider


Examples of org.apache.maven.scm.provider.ScmProvider

            firePutStarted( target, source );

            String msg = "Wagon: Adding " + source.getName() + " to repository";

            ScmProvider scmProvider = getScmProvider( scmRepository.getProvider() );

            String checkoutTargetName = source.isDirectory() ? targetName : getDirname( targetName );
            String relPath = checkOut( scmProvider, scmRepository, checkoutTargetName, target );

            File newCheckoutDirectory = new File( checkoutDirectory, relPath );

            File scmFile = new File( newCheckoutDirectory, source.isDirectory() ? "" : getFilename( targetName ) );

            boolean fileAlreadyInScm = scmFile.exists();

            if ( !scmFile.equals( source ) )
            {
                if ( source.isDirectory() )
                {
                    FileUtils.copyDirectoryStructure( source, scmFile );
                }
                else
                {
                    FileUtils.copyFile( source, scmFile );
                }
            }

            if ( !fileAlreadyInScm || scmFile.isDirectory() )
            {
                int addedFiles = addFiles( scmProvider, scmRepository, newCheckoutDirectory,
                                           source.isDirectory() ? "" : scmFile.getName() );

                if ( !fileAlreadyInScm && addedFiles == 0 )
                {
                    throw new ScmException(
                        "Unable to add file to SCM: " + scmFile + "; see error messages above for more information" );
                }
            }

            ScmResult result =
                scmProvider.checkIn( scmRepository, new ScmFileSet( checkoutDirectory ), makeScmVersion(), msg );

            checkScmResult( result );
        }
        catch ( ScmException e )
        {
View Full Code Here

Examples of org.apache.maven.scm.provider.ScmProvider

            File scmFile = new File( checkoutDirectory, resourceName );

            File basedir = scmFile.getParentFile();

            ScmProvider scmProvider = getScmProvider( scmRepository.getProvider() );

            String reservedScmFile = scmProvider.getScmSpecificFilename();

            if ( reservedScmFile != null && new File( basedir, reservedScmFile ).exists() )
            {
                scmProvider.update( scmRepository, new ScmFileSet( basedir ), makeScmVersion() );
            }
            else
            {
                // TODO: this should be checking out a full hierarchy (requires the -d equiv)
                basedir.mkdirs();

                scmProvider.checkOut( scmRepository, new ScmFileSet( basedir ), makeScmVersion() );
            }

            if ( !scmFile.exists() )
            {
                throw new ResourceDoesNotExistException( "Unable to find resource " + destination + " after checkout" );
View Full Code Here

Examples of org.apache.maven.scm.provider.ScmProvider

    {
        try
        {
            ScmRepository repository = getScmRepository( getRepository().getUrl() );

            ScmProvider provider = getScmProvider( repository.getProvider() );

            ListScmResult result =
                provider.list( repository, new ScmFileSet( new File( "." ), new File( resourcePath ) ), false,
                               makeScmVersion() );

            if ( !result.isSuccess() )
            {
                throw new ResourceDoesNotExistException( result.getProviderMessage() );
View Full Code Here

Examples of org.apache.maven.scm.provider.ScmProvider

    public void testBlameCommand()
        throws Exception
    {
        ScmRepository repository = getScmRepository();
        ScmManager manager = getScmManager();
        ScmProvider provider = manager.getProviderByRepository( getScmRepository() );
        ScmFileSet fileSet = new ScmFileSet( getWorkingCopy() );

        BlameScmResult result;
        BlameLine line;

        // === readme.txt ===
        result = manager.blame( repository, fileSet, "readme.txt" );
        assertNotNull( "The command returned a null result.", result );
        assertResultIsSuccess( result );
        assertEquals( "Expected 1 line in blame", 1, result.getLines().size() );
        line = result.getLines().get( 0 );
        String initialRevision = line.getRevision();

        //Make a timestamp that we know are after initial revision but before the second
        Date timeBeforeSecond = new Date(); // Current time
        // pause a couple seconds...
        Thread.sleep( 2000 );
        //Make a change to the readme.txt and commit the change
        ScmTestCase.makeFile( getWorkingCopy(), "/readme.txt", "changed readme.txt" );
        CheckInScmResult checkInResult = provider.checkIn( getScmRepository(), fileSet, COMMIT_MSG );
        assertTrue( "Unable to checkin changes to the repository", checkInResult.isSuccess() );

        result = manager.blame( repository, fileSet, "readme.txt" );

        // pause a couple seconds...
View Full Code Here

Examples of org.apache.maven.scm.provider.ScmProvider

        {
            logger = getScmLogger();

            for ( Entry<String, ScmProvider> entry : scmProviders.entrySet() )
            {
                ScmProvider p = entry.getValue();

                p.addListener( logger );
            }
        }

        String usedProviderType = System.getProperty( "maven.scm.provider." + providerType + ".implementation" );

        if ( usedProviderType == null )
        {
            if ( userProviderTypes.containsKey( providerType ) )
            {
                usedProviderType = userProviderTypes.get( providerType );
            }
            else
            {
                usedProviderType = providerType;
            }
        }

        ScmProvider scmProvider = scmProviders.get( usedProviderType );

        if ( scmProvider == null )
        {
            throw new NoSuchScmProviderException( usedProviderType );
        }
View Full Code Here

Examples of org.apache.maven.scm.provider.ScmProvider

        char delimiter = ScmUrlUtils.getDelimiter( scmUrl ).charAt( 0 );

        String providerType = ScmUrlUtils.getProvider( scmUrl );

        ScmProvider provider = getProviderByType( providerType );

        String scmSpecificUrl = cleanScmUrl( scmUrl.substring( providerType.length() + 5 ) );
       
        ScmProviderRepository providerRepository = provider.makeProviderScmRepository( scmSpecificUrl, delimiter );

        return new ScmRepository( providerType, providerRepository );
    }
View Full Code Here

Examples of org.apache.maven.scm.provider.ScmProvider

        if ( providerType == null )
        {
            throw new NullPointerException( "The provider type cannot be null." );
        }

        ScmProvider provider = getProviderByType( providerType );

        ScmProviderRepository providerRepository = provider.makeProviderScmRepository( path );

        return new ScmRepository( providerType, providerRepository );
    }
View Full Code Here

Examples of org.apache.maven.scm.provider.ScmProvider

        messages.addAll( ScmUrlUtils.validate( scmUrl ) );

        String providerType = ScmUrlUtils.getProvider( scmUrl );

        ScmProvider provider;

        try
        {
            provider = getProviderByType( providerType );
        }
        catch ( NoSuchScmProviderException e )
        {
            messages.add( "No such provider installed '" + providerType + "'." );

            return messages;
        }

        String scmSpecificUrl = cleanScmUrl( scmUrl.substring( providerType.length() + 5 ) );

        List<String> providerMessages =
            provider.validateScmUrl( scmSpecificUrl, ScmUrlUtils.getDelimiter( scmUrl ).charAt( 0 ) );

        if ( providerMessages == null )
        {
            throw new RuntimeException( "The SCM provider cannot return null from validateScmUrl()." );
        }
View Full Code Here

Examples of org.apache.maven.scm.provider.ScmProvider

    public void testChangeLogCommand()
        throws Exception
    {
        Thread.sleep( 1000 );
        ScmProvider provider = getScmManager().getProviderByRepository( getScmRepository() );
        ScmFileSet fileSet = new ScmFileSet( getWorkingCopy() );

        //We should have one log entry for the initial repository
        ChangeLogScmResult result =
            provider.changeLog( getScmRepository(), fileSet, null, null, 0, (ScmBranch) null, null );
        assertTrue( result.getProviderMessage(), result.isSuccess() );
        assertEquals( 1, result.getChangeLog().getChangeSets().size() );

        //Make a timestamp that we know are after initial revision but before the second
        Date timeBeforeSecond = new Date(); //Current time

        // pause a couple seconds... [SCM-244]
        Thread.sleep( 2000 );

        //Make a change to the readme.txt and commit the change
        ScmTestCase.makeFile( getWorkingCopy(), "/readme.txt", "changed readme.txt" );
        CheckInScmResult checkInResult = provider.checkIn( getScmRepository(), fileSet, COMMIT_MSG );
        assertTrue( "Unable to checkin changes to the repository", checkInResult.isSuccess() );

        result = provider.changeLog( getScmRepository(), fileSet, (ScmVersion) null, null );
        assertTrue( result.getProviderMessage(), result.isSuccess() );
        assertEquals( 2, result.getChangeLog().getChangeSets().size() );

        //Now only retrieve the changelog after timeBeforeSecondChangeLog
        Date currentTime = new Date();
        result = provider
            .changeLog( getScmRepository(), fileSet, timeBeforeSecond, currentTime, 0, new ScmBranch( "" ) );

        //Thorough assert of the last result
        assertTrue( result.getProviderMessage(), result.isSuccess() );
        assertEquals( 1, result.getChangeLog().getChangeSets().size() );
View Full Code Here

Examples of org.apache.maven.scm.provider.ScmProvider

                  + this.scmConnectionInfo + "\n    " + this.scmAccessInfo);
      }

      final ScmRepository repository =
              scmConnectionInfo.createRepository(scmManager);
      final ScmProvider provider = createScmProvider(repository);
      final ChangeLogScmResult result =
              scmAccessInfo.fetchChangeLog(repository, provider);

      Revision revision = null;
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.