@Override
  public Revision fetchLatestRevisionNumber() throws ScmException {
    if (LOG.isDebugEnabled()) {
      LOG.debug(
          "  Fetching latest revision number.\n    "
              + this.scmConnectionInfo
              + "\n    "
              + this.scmAccessInfo);
    }

    final ScmRepository repository = scmConnectionInfo.createRepository(scmManager);

    final ScmVersion remoteVersion = scmConnectionInfo.getRemoteVersion();
    if (remoteVersion != null && "git".equals(repository.getProvider())) {
      final Revision revision = scmAccessInfo.fetchRemoteGitVersion(repository, remoteVersion);
      return revision;
    } else {
      final ScmProvider provider = createScmProvider(repository);
      final ChangeLogScmResult result = scmAccessInfo.fetchChangeLog(repository, provider);

      if (result != null) {
        final ChangeLogSet changeLogSet = result.getChangeLog();
        final Revision revision = findEndVersion(changeLogSet);
        if (LOG.isDebugEnabled()) {
          LOG.debug("  Found revision '" + revision + "'.");
        }
        return revision;
      } else if (LOG.isDebugEnabled()) {
        LOG.debug("  No revision information found.");
      }
      return null;
    }
  }
コード例 #2
0
  private void testCommandLine(String scmUrl, String commandLine) throws Exception {
    workingDirectory.mkdirs();

    ScmRepository repository = getScmManager().makeScmRepository(scmUrl);
    PerforceScmProviderRepository svnRepository =
        (PerforceScmProviderRepository) repository.getProviderRepository();
    Commandline cl =
        PerforceCheckOutCommand.createCommandLine(
            svnRepository, workingDirectory, new ScmRevision("somelabel"), "test-test-maven");

    assertCommandLine(commandLine, null, cl);
  }