use of org.apache.maven.scm.command.status.StatusScmResult in project maven-scm by apache.
the class JazzScmProvider method status.
/**
* {@inheritDoc}
*/
protected StatusScmResult status(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
getLogger().debug("JazzScmProvider:status()");
JazzStatusCommand command = new JazzStatusCommand();
command.setLogger(getLogger());
return (StatusScmResult) command.execute(repository, fileSet, parameters);
}
use of org.apache.maven.scm.command.status.StatusScmResult in project maven-scm by apache.
the class SynergyRemoveCommand method executeRemoveCommand.
/**
* {@inheritDoc}
*/
protected ScmResult executeRemoveCommand(ScmProviderRepository repository, ScmFileSet fileSet, String message) throws ScmException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("executing remove command...");
}
SynergyScmProviderRepository repo = (SynergyScmProviderRepository) repository;
if (getLogger().isDebugEnabled()) {
getLogger().debug("basedir: " + fileSet.getBasedir());
}
String ccmAddr = SynergyUtil.start(getLogger(), repo.getUser(), repo.getPassword(), null);
try {
String projectSpec = SynergyUtil.getWorkingProject(getLogger(), repo.getProjectSpec(), repo.getUser(), ccmAddr);
if (projectSpec == null) {
throw new ScmException("You should checkout a working project first");
}
File waPath = SynergyUtil.getWorkArea(getLogger(), projectSpec, ccmAddr);
File destPath = new File(waPath, repo.getProjectName());
for (File f : fileSet.getFileList()) {
File source = new File(fileSet.getBasedir(), f.getPath());
File dest = new File(destPath, f.getPath());
SynergyUtil.delete(getLogger(), dest, ccmAddr, false);
if (!source.equals(dest)) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Delete file [" + source + "].");
}
dest.delete();
}
}
} finally {
SynergyUtil.stop(getLogger(), ccmAddr);
}
List<ScmFile> scmFiles = new ArrayList<ScmFile>();
for (File file : fileSet.getFileList()) {
scmFiles.add(new ScmFile(file.getPath(), ScmFileStatus.DELETED));
}
return new StatusScmResult("", scmFiles);
}
use of org.apache.maven.scm.command.status.StatusScmResult in project maven-scm by apache.
the class SynergyScmProvider method status.
/**
* {@inheritDoc}
*/
public StatusScmResult status(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
SynergyStatusCommand command = new SynergyStatusCommand();
command.setLogger(getLogger());
return (StatusScmResult) command.execute(repository, fileSet, parameters);
}
use of org.apache.maven.scm.command.status.StatusScmResult in project maven-scm by apache.
the class StarteamStatusCommand method executeStatusCommand.
// ----------------------------------------------------------------------
// AbstractStatusCommand Implementation
// ----------------------------------------------------------------------
/**
* {@inheritDoc}
*/
protected StatusScmResult executeStatusCommand(ScmProviderRepository repo, ScmFileSet fileSet) throws ScmException {
if (getLogger().isInfoEnabled()) {
getLogger().info("Working directory: " + fileSet.getBasedir().getAbsolutePath());
}
if (fileSet.getFileList().size() != 0) {
throw new ScmException("This provider doesn't support checking status of a subsets of a directory");
}
StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
StarteamStatusConsumer consumer = new StarteamStatusConsumer(getLogger(), fileSet.getBasedir());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
Commandline cl = createCommandLine(repository, fileSet);
int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
if (exitCode != 0) {
return new StatusScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
}
return new StatusScmResult(cl.toString(), consumer.getChangedFiles());
}
use of org.apache.maven.scm.command.status.StatusScmResult in project maven-scm by apache.
the class CheckLocalModificationsMojo method execute.
public void execute() throws MojoExecutionException {
if (skip) {
getLog().info("check-local-modification execution has been skipped");
return;
}
super.execute();
StatusScmResult result = null;
try {
ScmRepository repository = getScmRepository();
result = getScmManager().status(repository, new ScmFileSet(baseDirectory));
} catch (ScmException e) {
throw new MojoExecutionException(e.getMessage(), e);
}
if (!result.isSuccess()) {
throw new MojoExecutionException("Unable to check for local modifications : " + result.getProviderMessage());
}
if (!result.getChangedFiles().isEmpty()) {
getLog().error(errorMessage);
throw new MojoExecutionException(errorMessage);
}
}
Aggregations