use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.
the class IntegrityScmProvider method edit.
/**
* Maps to si makewritable
*/
@Override
protected EditScmResult edit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException {
IntegrityEditCommand command = new IntegrityEditCommand();
command.setLogger(getLogger());
return (EditScmResult) command.execute(repository, fileSet, params);
}
use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.
the class EditMojo method execute.
/**
* {@inheritDoc}
*/
public void execute() throws MojoExecutionException {
super.execute();
try {
ScmRepository repository = getScmRepository();
EditScmResult result = getScmManager().edit(repository, getFileSet());
checkResult(result);
} catch (IOException e) {
throw new MojoExecutionException("Cannot run edit command : ", e);
} catch (ScmException e) {
throw new MojoExecutionException("Cannot run edit command : ", e);
}
}
use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.
the class TfsScmProvider method edit.
protected EditScmResult edit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
TfsEditCommand command = new TfsEditCommand();
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 IntegrityEditCommand method executeEditCommand.
/**
* {@inheritDoc}
*/
@Override
public EditScmResult executeEditCommand(ScmProviderRepository repository, ScmFileSet fileSet) throws ScmException {
getLogger().info("Attempting make files writeable in Sandbox " + fileSet.getBasedir().getAbsolutePath());
EditScmResult result;
IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
try {
Sandbox siSandbox = iRepo.getSandbox();
Response res = siSandbox.makeWriteable();
int exitCode = res.getExitCode();
boolean success = (exitCode == 0 ? true : false);
result = new EditScmResult(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 EditScmResult(eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false);
}
return result;
}
use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.
the class StarteamEditCommand method executeEditCommand.
// ----------------------------------------------------------------------
// AbstractEditCommand Implementation
// ----------------------------------------------------------------------
/**
* {@inheritDoc}
*/
protected ScmResult executeEditCommand(ScmProviderRepository repo, ScmFileSet fileSet) throws ScmException {
if (getLogger().isInfoEnabled()) {
getLogger().info("Working directory: " + fileSet.getBasedir().getAbsolutePath());
}
StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
StarteamEditConsumer consumer = new StarteamEditConsumer(getLogger(), fileSet.getBasedir());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
List<File> editFiles = fileSet.getFileList();
if (editFiles.size() == 0) {
Commandline cl = createCommandLine(repository, fileSet);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new EditScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
}
} else {
// edit only interested files already on the local disk
for (int i = 0; i < editFiles.size(); ++i) {
ScmFileSet editFile = new ScmFileSet(fileSet.getBasedir(), (File) editFiles.get(i));
Commandline cl = createCommandLine(repository, editFile);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new EditScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
}
}
}
return new EditScmResult(null, consumer.getEditedFiles());
}
Aggregations