// native CVS stuff around (SM)
// We can't do it ourselves as jCVS is GPLed, a third party task
// outside of Apache repositories would be possible though (SB).
Environment env = new Environment();
if (port > 0) {
Environment.Variable var = new Environment.Variable();
var.setKey("CVS_CLIENT_PORT");
var.setValue(String.valueOf(port));
env.addVariable(var);
// non-standard environment variable used by CVSNT, WinCVS
// and others
var = new Environment.Variable();
var.setKey("CVS_PSERVER_PORT");
var.setValue(String.valueOf(port));
env.addVariable(var);
}
/**
* Need a better cross platform integration with <cvspass>, so
* use the same filename.
*/
if (passFile == null) {
File defaultPassFile = new File(
System.getProperty("cygwin.user.home",
System.getProperty("user.home"))
+ File.separatorChar + ".cvspass");
if (defaultPassFile.exists()) {
this.setPassfile(defaultPassFile);
}
}
if (passFile != null) {
if (passFile.isFile() && passFile.canRead()) {
Environment.Variable var = new Environment.Variable();
var.setKey("CVS_PASSFILE");
var.setValue(String.valueOf(passFile));
env.addVariable(var);
log("Using cvs passfile: " + String.valueOf(passFile),
Project.MSG_VERBOSE);
} else if (!passFile.canRead()) {
log("cvs passfile: " + String.valueOf(passFile)
+ " ignored as it is not readable",
Project.MSG_WARN);
} else {
log("cvs passfile: " + String.valueOf(passFile)
+ " ignored as it is not a file",
Project.MSG_WARN);
}
}
if (cvsRsh != null) {
Environment.Variable var = new Environment.Variable();
var.setKey("CVS_RSH");
var.setValue(String.valueOf(cvsRsh));
env.addVariable(var);
}
//
// Just call the getExecuteStreamHandler() and let it handle
// the semantics of instantiation or retrieval.
//
Execute exe = new Execute(getExecuteStreamHandler(), null);
exe.setAntRun(getProject());
if (dest == null) {
dest = getProject().getBaseDir();
}
if (!dest.exists()) {
dest.mkdirs();
}
exe.setWorkingDirectory(dest);
exe.setCommandline(toExecute.getCommandline());
exe.setEnvironment(env.getVariables());
try {
String actualCommandLine = executeToString(exe);
log(actualCommandLine, Project.MSG_VERBOSE);