use of org.apache.maven.scm.command.remove.RemoveScmResult in project maven-scm by apache.
the class AccuRevRemoveCommandTest method testAddFailed.
@Test
public void testAddFailed() throws Exception {
final ScmFileSet testFileSet = new ScmFileSet(basedir, new File("src/main/java/Foo.java"));
when(accurev.defunct(basedir, testFileSet.getFileList(), "A deleted file")).thenReturn(null);
AccuRevRemoveCommand command = new AccuRevRemoveCommand(getLogger());
CommandParameters commandParameters = new CommandParameters();
commandParameters.setString(CommandParameter.MESSAGE, "A deleted file");
RemoveScmResult result = command.remove(repo, testFileSet, commandParameters);
assertThat(result.isSuccess(), is(false));
assertThat(result.getProviderMessage(), notNullValue());
}
use of org.apache.maven.scm.command.remove.RemoveScmResult in project maven-scm by apache.
the class BazaarRemoveCommand method executeRemoveCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeRemoveCommand(ScmProviderRepository repository, ScmFileSet fileSet, String message) throws ScmException {
String[] command = new String[] { BazaarConstants.REMOVE_CMD };
BazaarUtils.expandCommandLine(command, fileSet);
File workingDir = fileSet.getBasedir();
BazaarRemoveConsumer consumer = new BazaarRemoveConsumer(getLogger(), workingDir);
ScmResult result = BazaarUtils.execute(consumer, getLogger(), workingDir, command);
return new RemoveScmResult(consumer.getRemovedFiles(), result);
}
use of org.apache.maven.scm.command.remove.RemoveScmResult in project maven-scm by apache.
the class PerforceRemoveCommand method executeRemoveCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeRemoveCommand(ScmProviderRepository repo, ScmFileSet files, String message) throws ScmException {
Commandline cl = createCommandLine((PerforceScmProviderRepository) repo, files.getBasedir(), files);
PerforceRemoveConsumer consumer = new PerforceRemoveConsumer();
try {
CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
int exitCode = CommandLineUtils.executeCommandLine(cl, consumer, err);
if (exitCode != 0) {
String cmdLine = CommandLineUtils.toString(cl.getCommandline());
StringBuilder msg = new StringBuilder("Exit code: " + exitCode + " - " + err.getOutput());
msg.append('\n');
msg.append("Command line was:" + cmdLine);
throw new CommandLineException(msg.toString());
}
} catch (CommandLineException e) {
throw new ScmException("CommandLineException " + e.getMessage(), e);
}
return new RemoveScmResult(cl.toString(), consumer.getRemovals());
}
use of org.apache.maven.scm.command.remove.RemoveScmResult in project maven-scm by apache.
the class IntegrityScmProvider method remove.
/**
* Maps to si dropsandbox
*/
@Override
protected RemoveScmResult remove(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException {
IntegrityRemoveCommand command = new IntegrityRemoveCommand();
command.setLogger(getLogger());
return (RemoveScmResult) command.execute(repository, fileSet, params);
}
use of org.apache.maven.scm.command.remove.RemoveScmResult in project maven-scm by apache.
the class HgRemoveCommand method executeRemoveCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeRemoveCommand(ScmProviderRepository repository, ScmFileSet fileSet, String message) throws ScmException {
String[] command = new String[] { HgCommandConstants.REMOVE_CMD };
command = HgUtils.expandCommandLine(command, fileSet);
File workingDir = fileSet.getBasedir();
HgRemoveConsumer consumer = new HgRemoveConsumer(getLogger(), workingDir);
ScmResult result = HgUtils.execute(consumer, getLogger(), workingDir, command);
return new RemoveScmResult(consumer.getRemovedFiles(), result);
}
Aggregations