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


Java ScmRepository类代码示例

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


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

示例1: renderAccessBehindFirewallSection

import org.apache.maven.scm.repository.ScmRepository; //导入依赖的package包/类
/**
 * Render the access from behind a firewall section
 *
 * @param devRepository the dev repository
 */
private void renderAccessBehindFirewallSection(ScmRepository devRepository) {
    startSection(getI18nString("accessbehindfirewall.title"));

    if (devRepository != null && isScmSystem(devRepository, "svn")) {
        SvnScmProviderRepository svnRepo = (SvnScmProviderRepository) devRepository.getProviderRepository();

        paragraph(getI18nString("accessbehindfirewall.svn.intro"));

        verbatimText("$ svn checkout " + svnRepo.getUrl() + " " + checkoutDirectoryName);
    } else if (devRepository != null && isScmSystem(devRepository, "cvs")) {
        linkPatternedText(getI18nString("accessbehindfirewall.cvs.intro"));
    } else {
        paragraph(getI18nString("accessbehindfirewall.general.intro"));
    }

    endSection();
}
 
开发者ID:bsorrentino,项目名称:maven-confluence-plugin,代码行数:23,代码来源:ScmRenderer.java

示例2: resolveBranchOrExpression

import org.apache.maven.scm.repository.ScmRepository; //导入依赖的package包/类
/**
 * Given the ScmManager for the current execution cycle, and the MavenProject structure, determine if we can
 * find a maven-provided manner of resolving the current git branch.
 *
 * @param scmManager The current maven ScmManager
 * @param project    The Current maven Project
 * @param log        A Log to write to
 * @return The current git branch name, or <code>${env.GIT_BRACH}</code> if the current git branch could not be resolved.
 * @throws ScmException
 */
public static String resolveBranchOrExpression(final ScmManager scmManager, final MavenProject project, final Log log) {
    String connectionUrl = resolveUrlOrExpression(project, log);

    // If a connectionURL other than the default expression was resolved, try to resolve the branch.
    if (!StringUtils.equals(connectionUrl, DEFAULT_URL_EXPRESSION)) {
        try {
            ScmRepository repository = scmManager.makeScmRepository(connectionUrl);
            ScmProvider provider = scmManager.getProviderByRepository(repository);

            if (GitScmProviderRepository.PROTOCOL_GIT.equals(provider.getScmType())) {
                ScmFileSet fileSet = new ScmFileSet(project.getBasedir());
                return GitBranchCommand.getCurrentBranch(new ScmLogDispatcher(), (GitScmProviderRepository) repository.getProviderRepository(), fileSet);
            } else {
                log.warn("Project SCM defines a non-git SCM provider. Falling back to  variable resolution.");
            }
        } catch (ScmException se) {
            log.warn("Unable to resolve Git Branch from Project SCM definition.", se);
        }
    }

    log.debug("Git branch unresolvable from Project SCM definition, defaulting to " + DEFAULT_BRANCH_EXPRESSION);
    return DEFAULT_BRANCH_EXPRESSION;
}
 
开发者ID:egineering-llc,项目名称:gitflow-helper-maven-plugin,代码行数:34,代码来源:ScmUtils.java

示例3: getScmRepository

import org.apache.maven.scm.repository.ScmRepository; //导入依赖的package包/类
protected ScmRepository getScmRepository()
    throws ScmException
{
    ScmRepository repository = scmManager.makeScmRepository( !StringUtils.isBlank( this.scmConnectionUrl )
                    ? scmConnectionUrl : scmDeveloperConnectionUrl );

    ScmProviderRepository scmRepo = repository.getProviderRepository();

    if ( scmRepo instanceof ScmProviderRepositoryWithHost )
    {
        loadInfosFromSettings( (ScmProviderRepositoryWithHost) scmRepo );
    }

    setPasswordIfNotEmpty( scmRepo, password );

    setUserIfNotEmpty( scmRepo, username );

    return repository;
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:20,代码来源:AbstractScmMojo.java

示例4: info

import org.apache.maven.scm.repository.ScmRepository; //导入依赖的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

示例5: findModifiedPaths

import org.apache.maven.scm.repository.ScmRepository; //导入依赖的package包/类
private Set<String> findModifiedPaths() throws MojoExecutionException {
  try {
    final ScmRepository repository = this.manager
        .makeScmRepository(getSCMConnection());
    final File scmRoot = scmRoot();
    this.getLog().info("Scm root dir is " + scmRoot);

    final Set<ScmFileStatus> statusToInclude = makeStatusSet();
    final Set<String> modifiedPaths;
    if (analyseLastCommit) {
      modifiedPaths = lastCommitChanges(statusToInclude, repository, scmRoot);
    } else if (originBranch != null && destinationBranch != null) {
      modifiedPaths = changesBetweenBranchs(originBranch, destinationBranch, statusToInclude, repository, scmRoot);
    } else {
      modifiedPaths = localChanges(statusToInclude, repository, scmRoot);
    }
    return modifiedPaths;
  } catch (final ScmException e) {
    throw new MojoExecutionException("Error while querying scm", e);
  }

}
 
开发者ID:hcoles,项目名称:pitest,代码行数:23,代码来源:ScmMojo.java

示例6: execute

import org.apache.maven.scm.repository.ScmRepository; //导入依赖的package包/类
private ScmResultWrapper execute(final ScmFileSet fileSet,
    final ScmRepository repository, final ScmProvider provider)
  throws org.apache.maven.scm.ScmException
{
  final ScmVersion remoteVersion = scmConnectionInfo.getRemoteVersion();
  final ScmResultWrapper result;
  if (remoteVersion != null)
  {
    final ScmVersion localVersion = null;
    result =
        createScmDiffResultWrapper(provider.diff(repository, fileSet,
            remoteVersion, localVersion));
  }
  else
  {
    result =
        createScmStatusResultWrapper(provider.status(repository, fileSet));
  }
  return result;
}
 
开发者ID:release-engineering,项目名称:buildmetadata-maven-plugin,代码行数:21,代码来源:MavenScmRevisionNumberFetcher.java

示例7: renderOverviewSection

import org.apache.maven.scm.repository.ScmRepository; //导入依赖的package包/类
/**
 * Render the overview section
 *
 * @param anonymousRepository the anonymous repository
 * @param devRepository the developer repository
 */
private void renderOverviewSection(ScmRepository anonymousRepository, ScmRepository devRepository) {
    startSection(getI18nString("overview.title"));

    if (isScmSystem(anonymousRepository, "clearcase") || isScmSystem(devRepository, "clearcase")) {
        sink.paragraph();
        linkPatternedText(getI18nString("clearcase.intro"));
        sink.paragraph_();
    } else if (isScmSystem(anonymousRepository, "cvs") || isScmSystem(devRepository, "cvs")) {
        sink.paragraph();
        linkPatternedText(getI18nString("cvs.intro"));
        sink.paragraph_();
    } else if (isScmSystem(anonymousRepository, "git") || isScmSystem(devRepository, "git")) {
        sink.paragraph();
        linkPatternedText(getI18nString("git.intro"));
        sink.paragraph_();
    } else if (isScmSystem(anonymousRepository, "hg") || isScmSystem(devRepository, "hg")) {
        sink.paragraph();
        linkPatternedText(getI18nString("hg.intro"));
        sink.paragraph_();
    } else if (isScmSystem(anonymousRepository, "perforce") || isScmSystem(devRepository, "perforce")) {
        sink.paragraph();
        linkPatternedText(getI18nString("perforce.intro"));
        sink.paragraph_();
    } else if (isScmSystem(anonymousRepository, "starteam") || isScmSystem(devRepository, "starteam")) {
        sink.paragraph();
        linkPatternedText(getI18nString("starteam.intro"));
        sink.paragraph_();
    } else if (isScmSystem(anonymousRepository, "svn") || isScmSystem(devRepository, "svn")) {
        sink.paragraph();
        linkPatternedText(getI18nString("svn.intro"));
        sink.paragraph_();
    } else {
        paragraph(getI18nString("general.intro"));
    }

    endSection();
}
 
开发者ID:bsorrentino,项目名称:maven-confluence-plugin,代码行数:44,代码来源:ScmRenderer.java

示例8: renderAnonymousAccessSection

import org.apache.maven.scm.repository.ScmRepository; //导入依赖的package包/类
/**
 * Render the anonymous access section depending the repository.
 * <p>
 * Note: ClearCase, Starteam et Perforce seems to have no anonymous access.
 * </p>
 *
 * @param anonymousRepository the anonymous repository
 */
private void renderAnonymousAccessSection(ScmRepository anonymousRepository) {
    if (isScmSystem(anonymousRepository, "clearcase") || isScmSystem(anonymousRepository, "perforce")
            || isScmSystem(anonymousRepository, "starteam") || StringUtils.isEmpty(anonymousConnection)) {
        return;
    }

    startSection(getI18nString("anonymousaccess.title"));

    if (anonymousRepository != null && isScmSystem(anonymousRepository, "cvs")) {
        CvsScmProviderRepository cvsRepo
                = (CvsScmProviderRepository) anonymousRepository.getProviderRepository();

        anonymousAccessCVS(cvsRepo);
    } else if (anonymousRepository != null && isScmSystem(anonymousRepository, "git")) {
        GitScmProviderRepository gitRepo
                = (GitScmProviderRepository) anonymousRepository.getProviderRepository();

        anonymousAccessGit(gitRepo);
    } else if (anonymousRepository != null && isScmSystem(anonymousRepository, "hg")) {
        HgScmProviderRepository hgRepo = (HgScmProviderRepository) anonymousRepository.getProviderRepository();

        anonymousAccessMercurial(hgRepo);
    } else if (anonymousRepository != null && isScmSystem(anonymousRepository, "svn")) {
        SvnScmProviderRepository svnRepo
                = (SvnScmProviderRepository) anonymousRepository.getProviderRepository();

        anonymousAccessSubversion(svnRepo);
    } else {
        paragraph(getI18nString("anonymousaccess.general.intro"));

        verbatimText(anonymousConnection.substring(4));
    }

    endSection();
}
 
开发者ID:bsorrentino,项目名称:maven-confluence-plugin,代码行数:44,代码来源:ScmRenderer.java

示例9: renderAccessThroughProxySection

import org.apache.maven.scm.repository.ScmRepository; //导入依赖的package包/类
/**
 * Render the access from behind a firewall section
 *
 * @param anonymousRepository the anonymous repository
 * @param devRepository the dev repository
 */
private void renderAccessThroughProxySection(ScmRepository anonymousRepository, ScmRepository devRepository) {
    if (isScmSystem(anonymousRepository, "svn") || isScmSystem(devRepository, "svn")) {
        startSection(getI18nString("accessthroughtproxy.title"));

        paragraph(getI18nString("accessthroughtproxy.svn.intro1"));
        paragraph(getI18nString("accessthroughtproxy.svn.intro2"));
        paragraph(getI18nString("accessthroughtproxy.svn.intro3"));

        verbatimText("[global]" + SystemUtils.LINE_SEPARATOR + "http-proxy-host = your.proxy.name"
                + SystemUtils.LINE_SEPARATOR + "http-proxy-port = 3128" + SystemUtils.LINE_SEPARATOR);

        endSection();
    }
}
 
开发者ID:bsorrentino,项目名称:maven-confluence-plugin,代码行数:21,代码来源:ScmRenderer.java

示例10: cloneRepository

import org.apache.maven.scm.repository.ScmRepository; //导入依赖的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

示例11: doCommit

import org.apache.maven.scm.repository.ScmRepository; //导入依赖的package包/类
/**
 * FIXME remove when upgrading to scm 1.8 as the method commit has been to protected
 */
protected void doCommit( File workingDirectory, ScmRepository repository )
    throws Exception
{
    CheckInScmResult result = getScmManager().checkIn( repository, new ScmFileSet( workingDirectory ), "No msg" );

    assertTrue( "Check result was successful, output: " + result.getCommandOutput(), result.isSuccess() );

    List<ScmFile> committedFiles = result.getCheckedInFiles();

    assertEquals( "Expected 2 files in the committed files list " + committedFiles, 2, committedFiles.size() );
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:15,代码来源:SvnJavaStatusCommandTckTest.java

示例12: update

import org.apache.maven.scm.repository.ScmRepository; //导入依赖的package包/类
public List<ScmFile> update()
    throws MojoExecutionException
{
    try
    {
        ScmRepository repository = getScmRepository();

        ScmProvider scmProvider = scmManager.getProviderByRepository( repository );

        UpdateScmResult result = scmProvider.update( repository, new ScmFileSet( scmDirectory ) );

        if ( result == null )
        {
            return Collections.emptyList();
        }

        checkResult( result );

        if ( result instanceof UpdateScmResultWithRevision )
        {
            String revision = ( (UpdateScmResultWithRevision) result ).getRevision();
            getLog().info( "Got a revision during update: " + revision );
            this.revision = revision;
        }

        return result.getUpdatedFiles();
    }
    catch ( ScmException e )
    {
        throw new MojoExecutionException( "Couldn't update project. " + e.getMessage(), e );
    }

}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:34,代码来源:CreateMojo.java

示例13: getScmBranch

import org.apache.maven.scm.repository.ScmRepository; //导入依赖的package包/类
/**
 * Get the branch info for this revision from the repository. For svn, it is in svn info.
 *
 * @return
 * @throws MojoExecutionException
 * @throws MojoExecutionException
 */
public String getScmBranch()
    throws MojoExecutionException
{
    try
    {
        ScmRepository repository = getScmRepository();
        ScmProvider provider = scmManager.getProviderByRepository( repository );
        /* git branch can be obtained directly by a command */
        if ( GitScmProviderRepository.PROTOCOL_GIT.equals( provider.getScmType() ) )
        {
            ScmFileSet fileSet = new ScmFileSet( scmDirectory );
            return GitBranchCommand.getCurrentBranch( getLogger(),
                                                      (GitScmProviderRepository) repository.getProviderRepository(),
                                                      fileSet );
        }
        else if ( provider instanceof HgScmProvider )
        {
            /* hg branch can be obtained directly by a command */
            HgOutputConsumer consumer = new HgOutputConsumer( getLogger() );
            ScmResult result = HgUtils.execute( consumer, logger, scmDirectory, new String[] { "id", "-b" } );
            checkResult( result );
            if ( StringUtils.isNotEmpty( consumer.getOutput() ) )
            {
                return consumer.getOutput();
            }
        }
    }
    catch ( ScmException e )
    {
        getLog().warn( "Cannot get the branch information from the git repository: \n" + e.getLocalizedMessage() );
    }

    return getScmBranchFromUrl();
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:42,代码来源:CreateMojo.java

示例14: makeChanges

import org.apache.maven.scm.repository.ScmRepository; //导入依赖的package包/类
private void makeChanges(ScmManager scmManager, ScmRepository scmRepository,
                         List<File> toCheckIn, List<File> toDelete, List<File> toAdd)
        throws ScmException {
    if (toAdd.size() > 0) {
        scmManager.add(scmRepository, new ScmFileSet(workingDir, toAdd), "");
    }
    if (toDelete.size() > 0) {
        scmManager.remove(scmRepository, new ScmFileSet(workingDir, toDelete), "");
    }
    if (toCheckIn.size() > 0) {
        scmManager.checkIn(scmRepository, new ScmFileSet(workingDir, toCheckIn), "");
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:14,代码来源:SCMUpdateTask.java

示例15: localChanges

import org.apache.maven.scm.repository.ScmRepository; //导入依赖的package包/类
private Set<String> localChanges(Set<ScmFileStatus> statusToInclude, ScmRepository repository, File scmRoot) throws ScmException {
  final StatusScmResult status = this.manager.status(repository,
          new ScmFileSet(scmRoot));
  Set<String> affected = new LinkedHashSet<>();
  for (final ScmFile file : status.getChangedFiles()) {
    if (statusToInclude.contains(file.getStatus())) {
      affected.add(file.getPath());
    }
  }
  return affected;
}
 
开发者ID:hcoles,项目名称:pitest,代码行数:12,代码来源:ScmMojo.java


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