use of org.apache.maven.scm.provider.starteam.command.checkin.StarteamCheckInConsumer in project maven-scm by apache.
the class StarteamRemoveCommand method executeRemoveCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeRemoveCommand(ScmProviderRepository repo, ScmFileSet fileSet, String message) throws ScmException {
if (getLogger().isInfoEnabled()) {
getLogger().info("Working directory: " + fileSet.getBasedir().getAbsolutePath());
}
StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
StarteamCheckInConsumer consumer = new StarteamCheckInConsumer(getLogger(), fileSet.getBasedir());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
List<File> remvoveFiles = fileSet.getFileList();
if (remvoveFiles.size() == 0) {
Commandline cl = createCommandLine(repository, fileSet);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new RemoveScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
}
} else {
// update only interested files already on the local disk
for (int i = 0; i < remvoveFiles.size(); ++i) {
File fileToBeRemoved = (File) remvoveFiles.get(i);
ScmFileSet scmFileSet = new ScmFileSet(fileSet.getBasedir(), fileToBeRemoved);
Commandline cl = createCommandLine(repository, scmFileSet);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new RemoveScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
}
}
}
return new RemoveScmResult(null, consumer.getCheckedInFiles());
}
Aggregations