use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.
the class JazzEditCommand method executeEditCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeEditCommand(ScmProviderRepository repo, ScmFileSet fileSet) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Executing edit command...");
}
DebugLoggerConsumer editConsumer = new DebugLoggerConsumer(getLogger());
ErrorConsumer errConsumer = new ErrorConsumer(getLogger());
JazzScmCommand editCmd = createEditCommand(repo, fileSet);
int status = editCmd.execute(editConsumer, errConsumer);
if (status != 0) {
return new EditScmResult(editCmd.getCommandString(), "Error code for Jazz SCM edit command - " + status, errConsumer.getOutput(), false);
}
return new EditScmResult(editCmd.getCommandString(), "Successfully Completed.", editConsumer.getOutput(), true);
}
use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.
the class JazzScmProvider method edit.
/**
* {@inheritDoc}
*/
protected EditScmResult edit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
getLogger().debug("JazzScmProvider:edit()");
JazzEditCommand command = new JazzEditCommand();
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 SynergyScmProvider method edit.
/**
* {@inheritDoc}
*/
public EditScmResult edit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
SynergyEditCommand command = new SynergyEditCommand();
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 StarteamScmProvider method edit.
/**
* {@inheritDoc}
*/
protected EditScmResult edit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
fileSet = fixUpScmFileSetAbsoluteFilePath(fileSet);
StarteamEditCommand command = new StarteamEditCommand();
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 SynergyEditCommand method executeEditCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeEditCommand(ScmProviderRepository repository, ScmFileSet fileSet) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing edit command...");
}
SynergyScmProviderRepository repo = (SynergyScmProviderRepository) repository;
if (getLogger().isDebugEnabled()) {
getLogger().debug(fileSet.toString());
}
String ccmAddr = SynergyUtil.start(getLogger(), repo.getUser(), repo.getPassword(), null);
try {
String projectSpec = SynergyUtil.getWorkingProject(getLogger(), repo.getProjectSpec(), repo.getUser(), ccmAddr);
File waPath = SynergyUtil.getWorkArea(getLogger(), projectSpec, ccmAddr);
File sourcePath = new File(waPath, repo.getProjectName());
if (projectSpec == null) {
throw new ScmException("You should checkout project first");
}
int taskNum = SynergyUtil.createTask(getLogger(), "Maven SCM Synergy provider: edit command for project " + repo.getProjectSpec(), repo.getProjectRelease(), true, ccmAddr);
if (getLogger().isInfoEnabled()) {
getLogger().info("Task " + taskNum + " was created to perform checkout.");
}
for (File f : fileSet.getFileList()) {
File dest = f;
File source = new File(sourcePath, SynergyUtil.removePrefix(fileSet.getBasedir(), f));
List<File> list = new LinkedList<File>();
list.add(source);
SynergyUtil.checkoutFiles(getLogger(), list, ccmAddr);
if (!source.equals(dest)) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Copy file [" + source + "] to expected folder [" + dest + "].");
}
try {
FileUtils.copyFile(source, dest);
} catch (IOException e) {
throw new ScmException("Unable to copy file from Work Area", e);
}
}
}
} finally {
SynergyUtil.stop(getLogger(), ccmAddr);
}
List<ScmFile> scmFiles = new ArrayList<ScmFile>(fileSet.getFileList().size());
for (File f : fileSet.getFileList()) {
scmFiles.add(new ScmFile(f.getPath(), ScmFileStatus.EDITED));
}
return new EditScmResult("", scmFiles);
}
Aggregations