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);
}
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());
}
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());
}
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());
//
}
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);
}
Aggregations