use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.
the class VssScmProvider method edit.
/**
* {@inheritDoc}
*/
public EditScmResult edit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
VssEditCommand command = new VssEditCommand();
command.setLogger(getLogger());
return (EditScmResult) command.execute(repository, fileSet, parameters);
}
use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.
the class VssEditCommand method executeEditCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeEditCommand(ScmProviderRepository repository, ScmFileSet fileSet) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing checkout command...");
}
VssScmProviderRepository repo = (VssScmProviderRepository) repository;
List<Commandline> commandLines = buildCmdLine(repo, fileSet);
VssEditConsumer consumer = new VssEditConsumer(repo, getLogger());
// TODO handle deleted files from VSS
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
StringBuilder sb = new StringBuilder();
List<ScmFile> updatedFiles = new ArrayList<ScmFile>();
for (Commandline cl : commandLines) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString());
}
exitCode = VssCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
String error = stderr.getOutput();
if (getLogger().isDebugEnabled()) {
getLogger().debug("VSS returns error: [" + error + "] return code: [" + exitCode + "]");
}
if (error.indexOf("A writable copy of") < 0) {
return new EditScmResult(cl.toString(), "The vss command failed.", error, false);
}
// print out the writable copy for manual handling
if (getLogger().isWarnEnabled()) {
getLogger().warn(error);
}
break;
}
sb.append(cl.toString() + '\n');
updatedFiles.addAll(consumer.getUpdatedFiles());
}
return new EditScmResult(sb.toString(), updatedFiles);
}
use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.
the class TfsEditCommand method executeEditCommand.
protected ScmResult executeEditCommand(ScmProviderRepository r, ScmFileSet f) throws ScmException {
FileListConsumer out = new FileListConsumer();
ErrorStreamConsumer err = new ErrorStreamConsumer();
TfsCommand command = createCommand(r, f);
int status = command.execute(out, err);
if (status != 0 || err.hasBeenFed()) {
return new EditScmResult(command.getCommandString(), "Error code for TFS edit command - " + status, err.getOutput(), false);
}
return new EditScmResult(command.getCommandString(), out.getFiles());
}
use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.
the class ClearCaseEditCommand method executeEditCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeEditCommand(ScmProviderRepository repository, ScmFileSet fileSet) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing edit command...");
}
Commandline cl = createCommandLine(getLogger(), fileSet);
ClearCaseEditConsumer consumer = new ClearCaseEditConsumer(getLogger());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
try {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString());
}
exitCode = CommandLineUtils.executeCommandLine(cl, consumer, stderr);
} catch (CommandLineException ex) {
throw new ScmException("Error while executing clearcase command.", ex);
}
if (exitCode != 0) {
return new EditScmResult(cl.toString(), "The cleartool command failed.", stderr.getOutput(), false);
}
return new EditScmResult(cl.toString(), consumer.getEditFiles());
}
use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.
the class ClearCaseScmProvider method edit.
/**
* {@inheritDoc}
*/
protected EditScmResult edit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
ClearCaseEditCommand command = new ClearCaseEditCommand();
command.setLogger(getLogger());
return (EditScmResult) command.execute(repository, fileSet, parameters);
}
Aggregations