use of org.apache.maven.scm.provider.starteam.command.checkout.StarteamCheckOutConsumer in project maven-scm by apache.
the class StarteamUpdateCommand method executeUpdateCommand.
// ----------------------------------------------------------------------
// AbstractUpdateCommand Implementation
// ----------------------------------------------------------------------
/**
* {@inheritDoc}
*/
protected UpdateScmResult executeUpdateCommand(ScmProviderRepository repo, ScmFileSet fileSet, ScmVersion version) throws ScmException {
if (getLogger().isInfoEnabled()) {
getLogger().info("Working directory: " + fileSet.getBasedir().getAbsolutePath());
}
StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
StarteamCheckOutConsumer consumer = new StarteamCheckOutConsumer(getLogger(), fileSet.getBasedir());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
List<File> updateFiles = fileSet.getFileList();
if (updateFiles.size() == 0) {
// update everything
Commandline cl = createCommandLine(repository, fileSet, version);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new UpdateScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
} else {
// hiden feature to allow Continuous Integration machine to
// delete local files. It affectively remove all build ouput as well
String doDeleteLocal = System.getProperty("maven.scm.starteam.deleteLocal");
if ("true".equalsIgnoreCase(doDeleteLocal)) {
this.deleteLocal(repository, fileSet, version);
}
}
} else {
// update only interested files already on the local disk
for (int i = 0; i < updateFiles.size(); ++i) {
File updateFile = (File) updateFiles.get(i);
ScmFileSet scmFileSet = new ScmFileSet(fileSet.getBasedir(), updateFile);
Commandline cl = createCommandLine(repository, scmFileSet, version);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new UpdateScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
}
}
}
return new UpdateScmResult(null, consumer.getCheckedOutFiles());
}
Aggregations