Search in sources :

Example 26 with CommandParameters

use of org.apache.maven.scm.CommandParameters in project maven-scm by apache.

the class GitBlameCommand method executeBlameCommand.

/**
 * {@inheritDoc}
 */
public BlameScmResult executeBlameCommand(ScmProviderRepository repo, ScmFileSet workingDirectory, String filename) throws ScmException {
    CommandParameters commandParameters = new CommandParameters();
    commandParameters.setString(CommandParameter.FILE, filename);
    commandParameters.setString(CommandParameter.IGNORE_WHITESPACE, Boolean.FALSE.toString());
    return (BlameScmResult) execute(repo, workingDirectory, commandParameters);
}
Also used : BlameScmResult(org.apache.maven.scm.command.blame.BlameScmResult) CommandParameters(org.apache.maven.scm.CommandParameters)

Example 27 with CommandParameters

use of org.apache.maven.scm.CommandParameters 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 28 with CommandParameters

use of org.apache.maven.scm.CommandParameters 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 29 with CommandParameters

use of org.apache.maven.scm.CommandParameters 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 30 with CommandParameters

use of org.apache.maven.scm.CommandParameters 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

CommandParameters (org.apache.maven.scm.CommandParameters)68 ScmFileSet (org.apache.maven.scm.ScmFileSet)44 File (java.io.File)39 AbstractAccuRevCommandTest (org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)38 Test (org.junit.Test)38 ScmFileMatcher.assertHasScmFile (org.apache.maven.scm.ScmFileMatcher.assertHasScmFile)23 ScmFile (org.apache.maven.scm.ScmFile)8 ScmTag (org.apache.maven.scm.ScmTag)7 CheckOutScmResult (org.apache.maven.scm.command.checkout.CheckOutScmResult)7 Date (java.util.Date)6 ChangeFile (org.apache.maven.scm.ChangeFile)5 ChangeFileMatcher.changeFile (org.apache.maven.scm.ChangeFileMatcher.changeFile)5 ScmRevision (org.apache.maven.scm.ScmRevision)5 ExportScmResult (org.apache.maven.scm.command.export.ExportScmResult)5 InfoScmResult (org.apache.maven.scm.command.info.InfoScmResult)5 LoginScmResult (org.apache.maven.scm.command.login.LoginScmResult)5 AccuRevInfo (org.apache.maven.scm.provider.accurev.AccuRevInfo)5 Transaction (org.apache.maven.scm.provider.accurev.Transaction)5 ArrayList (java.util.ArrayList)4 ScmException (org.apache.maven.scm.ScmException)4