當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。