use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.
the class PerforceEditCommand method executeEditCommand.
/**
* {@inheritDoc}
*/
@Override
protected ScmResult executeEditCommand(ScmProviderRepository repo, ScmFileSet files) throws ScmException {
Commandline cl = createCommandLine((PerforceScmProviderRepository) repo, files.getBasedir(), files);
PerforceEditConsumer consumer = new PerforceEditConsumer();
try {
if (getLogger().isDebugEnabled()) {
getLogger().debug(PerforceScmProvider.clean("Executing " + cl.toString()));
}
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) {
if (getLogger().isErrorEnabled()) {
getLogger().error("CommandLineException " + e.getMessage(), e);
}
}
if (consumer.isSuccess()) {
return new EditScmResult(cl.toString(), consumer.getEdits());
}
return new EditScmResult(cl.toString(), "Unable to edit file(s)", consumer.getErrorMessage(), false);
}
use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.
the class PerforceScmProvider method edit.
protected EditScmResult edit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException {
PerforceEditCommand command = new PerforceEditCommand();
command.setLogger(getLogger());
return (EditScmResult) command.execute(repository, fileSet, params);
}
Aggregations