Examples of InfoScmResult


Examples of org.apache.maven.scm.command.info.InfoScmResult

    protected String getRepositoryURL( File path )
        throws ScmException
    {
        // Note: I need to supply just 1 absolute path, but ScmFileSet won't let me without
        // a basedir (which isn't used here anyway), so use a dummy file.
        InfoScmResult result = info( null, new ScmFileSet( new File( "" ), path ), null );

        if ( result.getInfoItems().size() != 1 )
        {
            throw new ScmRepositoryException(
                "Cannot find URL: " + ( result.getInfoItems().size() == 0 ? "no" : "multiple" )
                    + " items returned by the info command" );
        }

        return result.getInfoItems().get( 0 ).getURL();
    }
View Full Code Here

Examples of org.apache.maven.scm.command.info.InfoScmResult

        GitScmTestUtils.initRepo( "src/test/resources/git/info", getRepositoryRoot(), getWorkingCopy() );

        ScmProvider provider = getScmManager().getProviderByUrl( getScmUrl() );
        ScmProviderRepository repository = provider.makeProviderScmRepository( getRepositoryRoot() );
        assertNotNull( repository );
        InfoScmResult result =
            provider.info( repository, new ScmFileSet( getRepositoryRoot() ), new CommandParameters() );
        assertNotNull( result );
        assertEquals( "cd3c0dfacb65955e6fbb35c56cc5b1bf8ce4f767", result.getInfoItems().get( 0 ).getRevision() );
        //
    }
View Full Code Here

Examples of org.apache.maven.scm.command.info.InfoScmResult

        ScmProvider provider = getScmManager().getProviderByUrl( getScmUrl() );
        ScmProviderRepository repository = provider.makeProviderScmRepository( getRepositoryRoot() );
        assertNotNull( repository );
        CommandParameters commandParameters = new CommandParameters();
        commandParameters.setInt( CommandParameter.SCM_SHORT_REVISION_LENGTH, 6 );
        InfoScmResult result = provider.info( repository, new ScmFileSet( getRepositoryRoot() ), commandParameters );
        assertNotNull( result );
        assertEquals( "revision must be short, exactly 6 digits ", "cd3c0d",
                      result.getInfoItems().get( 0 ).getRevision() );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.info.InfoScmResult

        ScmProvider provider = getScmManager().getProviderByUrl( getScmUrl() );
        ScmProviderRepository repository = provider.makeProviderScmRepository( getRepositoryRoot() );
        assertNotNull( repository );
        CommandParameters commandParameters = new CommandParameters();
        commandParameters.setInt( CommandParameter.SCM_SHORT_REVISION_LENGTH, GitInfoCommand.NO_REVISION_LENGTH );
        InfoScmResult result = provider.info( repository, new ScmFileSet( getRepositoryRoot() ), commandParameters );
        assertNotNull( result );
        assertEquals( "revision should not be short", "cd3c0dfacb65955e6fbb35c56cc5b1bf8ce4f767",
                      result.getInfoItems().get( 0 ).getRevision() );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.info.InfoScmResult

        ScmProvider provider = getScmManager().getProviderByUrl( getScmUrl() );
        ScmProviderRepository repository = provider.makeProviderScmRepository( getRepositoryRoot() );
        assertNotNull( repository );
        CommandParameters commandParameters = new CommandParameters();
        commandParameters.setInt( CommandParameter.SCM_SHORT_REVISION_LENGTH, 0 );
        InfoScmResult result = provider.info( repository, new ScmFileSet( getRepositoryRoot() ), commandParameters );
        assertNotNull( result );
        assertTrue( "revision should be not empty, minimum 4 (see git help rev-parse --short)",
                    result.getInfoItems().get( 0 ).getRevision().length() >= 4 );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.info.InfoScmResult

            throw new ScmException( "Error while executing command.", ex );
        }

        if ( exitCode != 0 )
        {
            return new InfoScmResult( cl.toString(), "The svn command failed.", stderr.getOutput(), false );
        }

        return new InfoScmResult( cl.toString(), consumer.getInfoItems() );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.info.InfoScmResult

        throws ScmException
    {
        // Note: I need to supply just 1 absolute path, but ScmFileSet won't let me without
        // a basedir (which isn't used here anyway), so use a dummy file.
        // and a dummy ScmProviderRepository
        InfoScmResult result = info( new GitScmProviderRepository( path.getPath() ), new ScmFileSet( path ), null );

        if ( result.getInfoItems().size() != 1 )
        {
            throw new ScmRepositoryException( "Cannot find URL: "
                + ( result.getInfoItems().size() == 0 ? "no" : "multiple" ) + " items returned by the info command" );
        }

        return result.getInfoItems().get( 0 ).getURL();
    }
View Full Code Here

Examples of org.apache.maven.scm.command.info.InfoScmResult

    }

    public InfoScmResult info( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
        throws ScmException
    {
        return new InfoScmResult( "", "", "", true );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.info.InfoScmResult

        Commandline cli = createCommandLine( repository, fileSet, parameters );

        int exitCode = GitCommandLineUtils.execute( cli, consumer, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            return new InfoScmResult( cli.toString(), "The git rev-parse command failed.", stderr.getOutput(), false );
        }
        return new InfoScmResult( cli.toString(), consumer.getInfoItems() );
    }
View Full Code Here

Examples of org.apache.maven.scm.command.info.InfoScmResult

        throws ScmException
    {
        // Note: I need to supply just 1 absolute path, but ScmFileSet won't let
        // me without
        // a basedir (which isn't used here anyway), so use a dummy file.
        InfoScmResult result = info( null, new ScmFileSet( new File( "" ), path ), null );

        if ( result.getInfoItems().size() != 1 )
        {
            throw new ScmRepositoryException(
                "Cannot find URL: " + ( result.getInfoItems().size() == 0 ? "no" : "multiple" )
                    + " items returned by the info command" );
        }

        return ( (GitInfoItem) result.getInfoItems().get( 0 ) ).getURL();
    }
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.