use of org.apache.maven.scm.command.remove.RemoveScmResult in project maven-scm by apache.
the class HgScmProvider method remove.
/**
* {@inheritDoc}
*/
public RemoveScmResult remove(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
HgRemoveCommand command = new HgRemoveCommand();
command.setLogger(getLogger());
return (RemoveScmResult) command.execute(repository, fileSet, parameters);
}
use of org.apache.maven.scm.command.remove.RemoveScmResult in project maven-scm by apache.
the class IntegrityRemoveCommand method executeRemoveCommand.
/**
* {@inheritDoc}
*/
@Override
public RemoveScmResult executeRemoveCommand(ScmProviderRepository repository, ScmFileSet fileSet, String message) throws ScmException {
getLogger().info("Attempting to un-register sandbox in directory " + fileSet.getBasedir().getAbsolutePath());
RemoveScmResult result;
IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
try {
Sandbox siSandbox = iRepo.getSandbox();
Response res = siSandbox.drop();
int exitCode = res.getExitCode();
boolean success = (exitCode == 0 ? true : false);
result = new RemoveScmResult(res.getCommandString(), "", "Exit Code: " + exitCode, success);
} catch (APIException aex) {
ExceptionHandler eh = new ExceptionHandler(aex);
getLogger().error("MKS API Exception: " + eh.getMessage());
getLogger().info(eh.getCommand() + " exited with return code " + eh.getExitCode());
result = new RemoveScmResult(eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false);
}
return result;
}
use of org.apache.maven.scm.command.remove.RemoveScmResult in project maven-scm by apache.
the class SvnRemoveCommand method executeRemoveCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeRemoveCommand(ScmProviderRepository repository, ScmFileSet fileSet, String message) throws ScmException {
if (fileSet.getFileList().isEmpty()) {
throw new ScmException("You must provide at least one file/directory to remove");
}
Commandline cl = createCommandLine(fileSet.getBasedir(), fileSet.getFileList());
SvnRemoveConsumer consumer = new SvnRemoveConsumer(getLogger());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
if (getLogger().isInfoEnabled()) {
getLogger().info("Executing: " + SvnCommandLineUtils.cryptPassword(cl));
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
getLogger().info("Working directory: " + cl.getWorkingDirectory().getAbsolutePath());
}
}
int exitCode;
try {
exitCode = SvnCommandLineUtils.execute(cl, consumer, stderr, getLogger());
} catch (CommandLineException ex) {
throw new ScmException("Error while executing command.", ex);
}
if (exitCode != 0) {
return new RemoveScmResult(cl.toString(), "The svn command failed.", stderr.getOutput(), false);
}
return new RemoveScmResult(cl.toString(), consumer.getRemovedFiles());
}
use of org.apache.maven.scm.command.remove.RemoveScmResult in project maven-scm by apache.
the class SynergyScmProvider method remove.
/**
* {@inheritDoc}
*/
public RemoveScmResult remove(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
SynergyRemoveCommand command = new SynergyRemoveCommand();
command.setLogger(getLogger());
return (RemoveScmResult) command.execute(repository, fileSet, parameters);
}
use of org.apache.maven.scm.command.remove.RemoveScmResult 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