use of org.codehaus.plexus.util.cli.Commandline in project maven-scm by apache.
the class VssCheckOutCommandTest method testCommandLine.
public void testCommandLine() throws Exception {
ScmRepository repository = scmManager.makeScmRepository("scm:vss|username|password@C:/Program File/Visual Source Safe|D:/myProject");
ScmFileSet fileSet = new ScmFileSet(getTestFile("target"));
VssCheckOutCommand command = new VssCheckOutCommand();
Commandline cl = command.buildCmdLine((VssScmProviderRepository) repository.getProviderRepository(), fileSet, null);
String ssPath = VssCommandLineUtils.getSsDir().replace('/', File.separatorChar);
assertCommandLine(ssPath + "ss Get $D:/myProject -Yusername,password -R -I- -GWR", fileSet.getBasedir(), cl);
}
use of org.codehaus.plexus.util.cli.Commandline in project maven-scm by apache.
the class VssEditCommandTest method testCommandLineFileSet.
public void testCommandLineFileSet() throws Exception {
File target = getTestFile(".");
ScmRepository repository = scmManager.makeScmRepository("scm:vss|username|password@C:/Program File/Visual Source Safe|D:/myProject");
ScmFileSet fileSet = new ScmFileSet(target, "**/target/**/VssEditCommandTest.class");
VssEditCommand command = new VssEditCommand();
List<Commandline> commands = command.buildCmdLine((VssScmProviderRepository) repository.getProviderRepository(), fileSet);
Commandline cl = commands.get(0);
String ssPath = VssCommandLineUtils.getSsDir().replace('/', File.separatorChar);
assertCommandLine(ssPath + "ss Checkout $D:/myProject/target/test-classes/org/apache/maven/scm/provider/vss/commands/edit/VssEditCommandTest.class -Yusername,password -I-", ((File) fileSet.getFileList().get(0)).getParentFile().getCanonicalFile(), cl);
}
use of org.codehaus.plexus.util.cli.Commandline in project maven-scm by apache.
the class VssEditCommandTest method testCommandLineRelativePath.
public void testCommandLineRelativePath() throws Exception {
ScmRepository repository = scmManager.makeScmRepository("scm:vss|username|password@C:/Program File/Visual Source Safe|D:/myProject");
File target = getTestFile("target");
ScmFileSet fileSet = new ScmFileSet(target, new File(target, "test-classes/org/apache/maven/scm/provider/vss/commands/edit/VssEditCommandTest.class"));
VssEditCommand command = new VssEditCommand();
List<Commandline> commands = command.buildCmdLine((VssScmProviderRepository) repository.getProviderRepository(), fileSet);
Commandline cl = commands.get(0);
String ssPath = VssCommandLineUtils.getSsDir().replace('/', File.separatorChar);
assertCommandLine(ssPath + "ss Checkout $D:/myProject/test-classes/org/apache/maven/scm/provider/vss/commands/edit/VssEditCommandTest.class -Yusername,password -I-", ((File) fileSet.getFileList().get(0)).getParentFile().getCanonicalFile(), cl);
}
use of org.codehaus.plexus.util.cli.Commandline in project maven-scm by apache.
the class CvsCommandUtils method getBaseCommand.
public static Commandline getBaseCommand(String commandName, CvsScmProviderRepository repo, ScmFileSet fileSet, String options, boolean addCvsRoot) {
Settings settings = CvsUtil.getSettings();
Commandline cl = new Commandline();
cl.setExecutable("cvs");
cl.setWorkingDirectory(fileSet.getBasedir().getAbsolutePath());
if (Boolean.getBoolean("maven.scm.cvs.use_compression")) {
cl.createArg().setValue("-z" + System.getProperty("maven.scm.cvs.compression_level", "3"));
} else if (settings.getCompressionLevel() > 0) {
cl.createArg().setValue("-z" + settings.getCompressionLevel());
}
if (!settings.isUseCvsrc()) {
// don't use ~/.cvsrc
cl.createArg().setValue("-f");
}
if (settings.isTraceCvsCommand()) {
cl.createArg().setValue("-t");
}
if (!StringUtils.isEmpty(settings.getTemporaryFilesDirectory())) {
File tempDir = new File(settings.getTemporaryFilesDirectory());
if (!tempDir.exists()) {
tempDir.mkdirs();
}
cl.createArg().setValue("-T");
cl.createArg().setValue(tempDir.getAbsolutePath());
}
if (settings.getCvsVariables().size() > 0) {
for (Enumeration<?> e = settings.getCvsVariables().propertyNames(); e.hasMoreElements(); ) {
String key = (String) e.nextElement();
String value = settings.getCvsVariables().getProperty(key);
cl.createArg().setValue("-s");
cl.createArg().setValue(key + "=" + value);
}
}
if (addCvsRoot) {
cl.createArg().setValue("-d");
cl.createArg().setValue(repo.getCvsRoot());
}
cl.createArg().setLine(options);
cl.createArg().setValue("-q");
cl.createArg().setValue(commandName);
return cl;
}
use of org.codehaus.plexus.util.cli.Commandline in project maven-scm by apache.
the class AbstractCvsBlameCommand method executeBlameCommand.
/**
* {@inheritDoc}
*/
public BlameScmResult executeBlameCommand(ScmProviderRepository repo, ScmFileSet fileSet, String filename) throws ScmException {
CvsScmProviderRepository repository = (CvsScmProviderRepository) repo;
Commandline cl = CvsCommandUtils.getBaseCommand("annotate", repository, fileSet);
cl.createArg().setValue(filename);
if (getLogger().isInfoEnabled()) {
getLogger().info("Executing: " + cl);
getLogger().info("Working directory: " + cl.getWorkingDirectory().getAbsolutePath());
}
return executeCvsCommand(cl, repository);
}
Aggregations