当前位置: 首页>>代码示例>>Java>>正文


Java ScmTag类代码示例

本文整理汇总了Java中org.apache.maven.scm.ScmTag的典型用法代码示例。如果您正苦于以下问题:Java ScmTag类的具体用法?Java ScmTag怎么用?Java ScmTag使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ScmTag类属于org.apache.maven.scm包,在下文中一共展示了ScmTag类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: info

import org.apache.maven.scm.ScmTag; //导入依赖的package包/类
/**
 * Get info from scm.
 *
 * @param repository
 * @param fileSet
 * @return
 * @throws ScmException
 * @todo this should be rolled into org.apache.maven.scm.provider.ScmProvider and
 *       org.apache.maven.scm.provider.svn.SvnScmProvider
 */
protected InfoScmResult info( ScmRepository repository, ScmFileSet fileSet )
    throws ScmException
{
    CommandParameters commandParameters = new CommandParameters();

    // only for Git, we will make a test for shortRevisionLength parameter
    if ( GitScmProviderRepository.PROTOCOL_GIT.equals( scmManager.getProviderByRepository( repository ).getScmType() )
        && this.shortRevisionLength > 0 )
    {
        getLog().info( "ShortRevision tag detected. The value is '" + this.shortRevisionLength + "'." );
        if ( shortRevisionLength >= 0 && shortRevisionLength < 4 )
        {
            getLog().warn( "shortRevision parameter less then 4. ShortRevisionLength is relaying on 'git rev-parese --short=LENGTH' command, accordingly to Git rev-parse specification the LENGTH value is miminum 4. " );
        }
        commandParameters.setInt( CommandParameter.SCM_SHORT_REVISION_LENGTH, this.shortRevisionLength );
    }

    if ( !StringUtils.isBlank( scmTag ) && !"HEAD".equals( scmTag ) )
    {
        commandParameters.setScmVersion( CommandParameter.SCM_VERSION, new ScmTag( scmTag ) );
    }

    return scmManager.getProviderByRepository( repository ).info( repository.getProviderRepository(), fileSet,
                                                                  commandParameters );
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:36,代码来源:AbstractScmMojo.java

示例2: cloneRepository

import org.apache.maven.scm.ScmTag; //导入依赖的package包/类
public CheckOutScmResult cloneRepository(String scmUrl, String revision, String cloneTo) throws ScmException {

        File buildDir = new File(cloneTo);
        if (!buildDir.exists())
            buildDir.mkdir();

        ScmRepository repo = getScmRepository(String.format("scm:%s:%s", repositoryType.name(), scmUrl), scmManager);
        return scmManager.checkOut(repo, new ScmFileSet(buildDir), new ScmTag(revision));
    }
 
开发者ID:ahmedlawi92,项目名称:pnc-local,代码行数:10,代码来源:ScmRetriever.java

示例3: executeListCommand

import org.apache.maven.scm.ScmTag; //导入依赖的package包/类
@Override
protected ListScmResult executeListCommand( ScmProviderRepository scmProviderRepository, ScmFileSet scmFileSet,
                                            boolean recursive, ScmVersion version )
    throws ScmException
{
    SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) scmProviderRepository;

    String url = javaRepo.getUrl();

    SVNRevision revision = SVNRevision.HEAD;

    if ( version != null && StringUtils.isNotEmpty( version.getName() ) )
    {
        if ( version instanceof ScmTag )
        {
            url = SvnTagBranchUtils.resolveTagUrl( javaRepo, (ScmTag) version );
        }
        else if ( version instanceof ScmBranch )
        {
            url = SvnTagBranchUtils.resolveBranchUrl( javaRepo, (ScmBranch) version );
        }
        else if ( version instanceof ScmRevision )
        {
            try
            {
                revision = SVNRevision.create( Long.parseLong( ( (ScmRevision) version ).getName() ) );
            }
            catch ( NumberFormatException exc )
            {
                return new ListScmResult( SvnJavaScmProvider.COMMAND_LINE,
                                          "SVN checkout failed. Wrong format of revision number.", null, false );
            }
        }
    }

    if ( url != null )
    {
        url = SvnCommandUtils.fixUrl( url, javaRepo.getUser() );
    }
    ListEntryHandler listEntryHandler = new ListEntryHandler();

    /*
    SVNURL url,
    SVNRevision pegRevision,
    SVNRevision revision,
    boolean fetchLocks,
    SVNDepth depth,
    int entryFields,
    ISVNDirEntryHandler handler
    */

    try
    {
        javaRepo.getClientManager().getLogClient().doList(
            url == null ? javaRepo.getSvnUrl() : SVNURL.parseURIEncoded( url ), revision, revision, true,
            // boolean fetchLocks,
            SVNDepth.IMMEDIATES, 0, listEntryHandler );
    }
    catch ( SVNException e )
    {
        throw new ScmException( "Error while executing svn list.", e );
    }

    List<ScmFile> scmFiles = new ArrayList<ScmFile>( listEntryHandler.relativePaths.size() );

    for ( String path : listEntryHandler.relativePaths )
    {
        scmFiles.add( new ScmFile( path, ScmFileStatus.CHECKED_IN ) );
    }

    ListScmResult listScmResult = new ListScmResult( scmFiles, new ScmResult( null, null, null, false ) );
    return listScmResult;

}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:75,代码来源:SvnJavaListCommand.java

示例4: executeUpdateCommand

import org.apache.maven.scm.ScmTag; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
protected UpdateScmResult executeUpdateCommand( ScmProviderRepository repo, ScmFileSet fileSet, ScmVersion tag )
    throws ScmException
{
    SvnScmProviderRepository repository = (SvnScmProviderRepository) repo;

    if ( getLogger().isInfoEnabled() )
    {
        getLogger().info( "SVN update directory: " + fileSet.getBasedir().getAbsolutePath() );
    }

    SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;

    try
    {
        ScmFileEventHandler handler = new ScmFileEventHandler( getLogger(), fileSet.getBasedir() );

        SVNUpdateClient updateClient = javaRepo.getClientManager().getUpdateClient();

        updateClient.setEventHandler( handler );

        long revision = 0;

        if ( tag == null || SvnTagBranchUtils.isRevisionSpecifier( tag ) )
        {
            SVNRevision rev = ( tag == null ? SVNRevision.parse( "" ) : SVNRevision.parse( tag.getName() ) );
            revision = SvnJavaUtil.update( updateClient, fileSet.getBasedir(), rev, true );
        }
        else
        {
            // The tag specified does not appear to be numeric, so assume it refers
            // to a branch/tag url and perform a switch operation rather than update
            revision = SvnJavaUtil.switchToURL( javaRepo.getClientManager(), fileSet.getBasedir(),
                                                SVNURL.parseURIEncoded( SvnTagBranchUtils.resolveTagUrl( repository,
                                                                                                         new ScmTag(
                                                                                                             tag.getName() ) ) ),
                                                SVNRevision.HEAD, true );
        }

        return new UpdateScmResultWithRevision( SvnJavaScmProvider.COMMAND_LINE, handler.getFiles(),
                                                Long.toString( revision ) );
    }
    catch ( SVNException e )
    {
        return new UpdateScmResultWithRevision( SvnJavaScmProvider.COMMAND_LINE, "SVN update failed.",
                                                e.getMessage(), Long.toString( -1 ), false );
    }
    finally
    {
        javaRepo.getClientManager().getUpdateClient().setEventHandler( null );
    }
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:55,代码来源:SvnJavaUpdateCommand.java

示例5: executeCheckOutCommand

import org.apache.maven.scm.ScmTag; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
protected CheckOutScmResult executeCheckOutCommand( ScmProviderRepository repo, ScmFileSet fileSet,
                                                    ScmVersion version, boolean recursive )
    throws ScmException
{
    if ( getLogger().isInfoEnabled() )
    {
        getLogger().info( "SVN checkout directory: " + fileSet.getBasedir().getAbsolutePath() );
    }

    SvnScmProviderRepository repository = (SvnScmProviderRepository) repo;

    String url = repository.getUrl();

    SVNRevision revision = SVNRevision.HEAD;

    if ( version != null && StringUtils.isNotEmpty( version.getName() ) )
    {
        if ( version instanceof ScmTag )
        {
            url = SvnTagBranchUtils.resolveTagUrl( repository, (ScmTag) version );
        }
        else if ( version instanceof ScmBranch )
        {
            url = SvnTagBranchUtils.resolveBranchUrl( repository, (ScmBranch) version );
        }
        else if ( version instanceof ScmRevision )
        {
            try
            {
                revision = SVNRevision.create( Long.parseLong( ( (ScmRevision) version ).getName() ) );
            }
            catch ( NumberFormatException exc )
            {
                return new CheckOutScmResult( SvnJavaScmProvider.COMMAND_LINE,
                                              "SVN checkout failed. Wrong format of revision number.", null,
                                              false );
            }
        }
    }

    url = SvnCommandUtils.fixUrl( url, repository.getUser() );

    SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;

    ScmFileEventHandler handler = new ScmFileEventHandler( getLogger(), fileSet.getBasedir() );
    SVNUpdateClient updateClient = javaRepo.getClientManager().getUpdateClient();
    updateClient.setEventHandler( handler );

    try
    {
        SvnJavaUtil.checkout( updateClient, SVNURL.parseURIEncoded( url ), revision, fileSet.getBasedir(), true );

        return new CheckOutScmResult( SvnJavaScmProvider.COMMAND_LINE, handler.getFiles() );
    }
    catch ( SVNException e )
    {
        return new CheckOutScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN checkout failed.", e.getMessage(),
                                      false );
    }
    finally
    {
        javaRepo.getClientManager().getUpdateClient().setEventHandler( null );
    }
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:68,代码来源:SvnJavaCheckOutCommand.java

示例6: executeExportCommand

import org.apache.maven.scm.ScmTag; //导入依赖的package包/类
/**
 * @see org.apache.maven.scm.command.export.AbstractExportCommand#executeExportCommand(org.apache.maven.scm.provider.ScmProviderRepository, org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.ScmVersion, java.lang.String)
 */
protected ExportScmResult executeExportCommand( ScmProviderRepository repo, ScmFileSet fileSet, ScmVersion version,
                                                String outputDirectory )
    throws ScmException
{
    SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;

    ScmFileEventHandler handler = new ScmFileEventHandler( getLogger(), fileSet.getBasedir() );

    javaRepo.getClientManager().getUpdateClient().setEventHandler( handler );
    String url = javaRepo.getUrl();

    if ( version != null && StringUtils.isNotEmpty( version.getName() ) )
    {
        if ( version instanceof ScmTag )
        {
            url = SvnTagBranchUtils.resolveTagUrl( javaRepo, (ScmTag) version );
        }
        else if ( version instanceof ScmBranch )
        {
            url = SvnTagBranchUtils.resolveBranchUrl( javaRepo, (ScmBranch) version );
        }
    }

    url = SvnCommandUtils.fixUrl( url, javaRepo.getUser() );
    try
    {
        SvnJavaUtil.export( javaRepo.getClientManager(), SVNURL.parseURIEncoded( url ), SVNRevision.HEAD,
                            fileSet.getBasedir(), true );

        return new ExportScmResult( SvnJavaScmProvider.COMMAND_LINE, handler.getFiles() );
    }
    catch ( SVNException e )
    {
        return new ExportScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN checkout failed.", e.getMessage(),
                                    false );
    }
    finally
    {
        javaRepo.getClientManager().getUpdateClient().setEventHandler( null );
    }

}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:46,代码来源:SvnJavaExportCommand.java


注:本文中的org.apache.maven.scm.ScmTag类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。