use of org.apache.maven.scm.command.add.AddScmResult in project maven-scm by apache.
the class PerforceAddCommand method executeAddCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeAddCommand(ScmProviderRepository repo, ScmFileSet files, String message, boolean binary) throws ScmException {
Commandline cl = createCommandLine((PerforceScmProviderRepository) repo, files.getBasedir(), files);
PerforceAddConsumer consumer = new PerforceAddConsumer();
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) {
if (getLogger().isErrorEnabled()) {
getLogger().error("CommandLineException " + e.getMessage(), e);
}
}
return new AddScmResult(cl.toString(), consumer.getAdditions());
}
use of org.apache.maven.scm.command.add.AddScmResult in project maven-scm by apache.
the class IntegrityScmProvider method add.
/**
* Maps to si viewnonmembers and then si add for every non-member
*/
@Override
public AddScmResult add(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException {
IntegrityAddCommand command = new IntegrityAddCommand();
command.setLogger(getLogger());
return (AddScmResult) command.execute(repository, fileSet, params);
}
use of org.apache.maven.scm.command.add.AddScmResult in project maven-scm by apache.
the class AddMojo method execute.
/**
* {@inheritDoc}
*/
public void execute() throws MojoExecutionException {
super.execute();
try {
ScmRepository repository = getScmRepository();
AddScmResult result = getScmManager().add(repository, getFileSet());
checkResult(result);
getLog().info("" + result.getAddedFiles().size() + " files successfully added.");
} catch (IOException e) {
throw new MojoExecutionException("Cannot run add command : ", e);
} catch (ScmException e) {
throw new MojoExecutionException("Cannot run add command : ", e);
}
}
use of org.apache.maven.scm.command.add.AddScmResult in project maven-scm by apache.
the class VssScmProvider method add.
/**
* {@inheritDoc}
*/
public AddScmResult add(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
// TODO: Check whether the CREATE command must be called
VssAddCommand command = new VssAddCommand();
command.setLogger(getLogger());
return (AddScmResult) command.execute(repository, fileSet, parameters);
}
use of org.apache.maven.scm.command.add.AddScmResult in project maven-scm by apache.
the class VssAddCommand method executeAddCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeAddCommand(ScmProviderRepository repository, ScmFileSet fileSet, String message, boolean binary) throws ScmException {
VssScmProviderRepository repo = (VssScmProviderRepository) repository;
if (fileSet.getFileList().isEmpty()) {
throw new ScmException("You must provide at least one file/directory to add");
}
Commandline cl = buildCmdLine(repo, fileSet);
VssAddConsumer consumer = new VssAddConsumer(getLogger());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
if (getLogger().isInfoEnabled()) {
getLogger().info("Executing: " + cl);
getLogger().info("Working directory: " + cl.getWorkingDirectory().getAbsolutePath());
}
int exitCode = VssCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new ChangeLogScmResult(cl.toString(), "The vss command failed.", stderr.getOutput(), false);
}
return new AddScmResult(cl.toString(), consumer.getAddedFiles());
}
Aggregations