Search in sources :

Example 1 with ScmProviderRepository

use of org.apache.maven.scm.provider.ScmProviderRepository in project maven-scm by apache.

the class HgChangeLogCommand method executeChangeLogCommand.

/**
 * {@inheritDoc}
 */
@Override
protected ChangeLogScmResult executeChangeLogCommand(ChangeLogScmRequest request) throws ScmException {
    final ScmVersion startVersion = request.getStartRevision();
    final ScmVersion endVersion = request.getEndRevision();
    final ScmFileSet fileSet = request.getScmFileSet();
    final String datePattern = request.getDatePattern();
    if (startVersion != null || endVersion != null) {
        final ScmProviderRepository scmProviderRepository = request.getScmRepository().getProviderRepository();
        return executeChangeLogCommand(scmProviderRepository, fileSet, startVersion, endVersion, datePattern);
    }
    return executeChangeLogCommand(fileSet, request.getStartDate(), request.getEndDate(), datePattern, request.getLimit());
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) ScmProviderRepository(org.apache.maven.scm.provider.ScmProviderRepository) ScmVersion(org.apache.maven.scm.ScmVersion)

Example 2 with ScmProviderRepository

use of org.apache.maven.scm.provider.ScmProviderRepository in project maven-scm by apache.

the class GitInfoCommandTckTest method testInfoCommandWithNegativeShortRevision.

public void testInfoCommandWithNegativeShortRevision() throws Exception {
    GitScmTestUtils.initRepo("src/test/resources/git/info", getRepositoryRoot(), getWorkingCopy());
    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());
}
Also used : ScmProvider(org.apache.maven.scm.provider.ScmProvider) ScmFileSet(org.apache.maven.scm.ScmFileSet) ScmProviderRepository(org.apache.maven.scm.provider.ScmProviderRepository) InfoScmResult(org.apache.maven.scm.command.info.InfoScmResult) CommandParameters(org.apache.maven.scm.CommandParameters)

Example 3 with ScmProviderRepository

use of org.apache.maven.scm.provider.ScmProviderRepository in project maven-scm by apache.

the class GitInfoCommandTckTest method testInfoCommandWithShortRevision.

public void testInfoCommandWithShortRevision() throws Exception {
    GitScmTestUtils.initRepo("src/test/resources/git/info", getRepositoryRoot(), getWorkingCopy());
    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());
}
Also used : ScmProvider(org.apache.maven.scm.provider.ScmProvider) ScmFileSet(org.apache.maven.scm.ScmFileSet) ScmProviderRepository(org.apache.maven.scm.provider.ScmProviderRepository) InfoScmResult(org.apache.maven.scm.command.info.InfoScmResult) CommandParameters(org.apache.maven.scm.CommandParameters)

Example 4 with ScmProviderRepository

use of org.apache.maven.scm.provider.ScmProviderRepository in project maven-scm by apache.

the class GitInfoCommandTckTest method testInfoCommand.

public void testInfoCommand() throws Exception {
    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());
// 
}
Also used : ScmProvider(org.apache.maven.scm.provider.ScmProvider) ScmFileSet(org.apache.maven.scm.ScmFileSet) ScmProviderRepository(org.apache.maven.scm.provider.ScmProviderRepository) InfoScmResult(org.apache.maven.scm.command.info.InfoScmResult) CommandParameters(org.apache.maven.scm.CommandParameters)

Example 5 with ScmProviderRepository

use of org.apache.maven.scm.provider.ScmProviderRepository in project maven-scm by apache.

the class GitInfoCommandTckTest method testInfoCommandWithZeroShortRevision.

public void testInfoCommandWithZeroShortRevision() throws Exception {
    GitScmTestUtils.initRepo("src/test/resources/git/info", getRepositoryRoot(), getWorkingCopy());
    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);
}
Also used : ScmProvider(org.apache.maven.scm.provider.ScmProvider) ScmFileSet(org.apache.maven.scm.ScmFileSet) ScmProviderRepository(org.apache.maven.scm.provider.ScmProviderRepository) InfoScmResult(org.apache.maven.scm.command.info.InfoScmResult) CommandParameters(org.apache.maven.scm.CommandParameters)

Aggregations

ScmProviderRepository (org.apache.maven.scm.provider.ScmProviderRepository)11 ScmFileSet (org.apache.maven.scm.ScmFileSet)6 ScmProvider (org.apache.maven.scm.provider.ScmProvider)6 ScmRepository (org.apache.maven.scm.repository.ScmRepository)5 CommandParameters (org.apache.maven.scm.CommandParameters)4 InfoScmResult (org.apache.maven.scm.command.info.InfoScmResult)4 IOException (java.io.IOException)2 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)2 ScmException (org.apache.maven.scm.ScmException)2 ScmVersion (org.apache.maven.scm.ScmVersion)2 ScmProviderRepositoryWithHost (org.apache.maven.scm.provider.ScmProviderRepositoryWithHost)2 SvnScmProviderRepository (org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository)2 FileNotFoundException (java.io.FileNotFoundException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 ParseException (java.text.ParseException)1 MavenReportException (org.apache.maven.reporting.MavenReportException)1 ScmRepositoryException (org.apache.maven.scm.repository.ScmRepositoryException)1 SecDispatcherException (org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException)1