use of org.apache.maven.scm.command.update.UpdateScmResult in project maven-scm by apache.
the class ClearCaseScmProvider method update.
/**
* {@inheritDoc}
*/
protected UpdateScmResult update(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
ClearCaseUpdateCommand command = new ClearCaseUpdateCommand();
command.setLogger(getLogger());
return (UpdateScmResult) command.execute(repository, fileSet, parameters);
}
use of org.apache.maven.scm.command.update.UpdateScmResult in project maven-scm by apache.
the class CvsExeUpdateCommand method executeCvsCommand.
/**
* {@inheritDoc}
*/
protected UpdateScmResult executeCvsCommand(Commandline cl) throws ScmException {
CvsUpdateConsumer consumer = new CvsUpdateConsumer(getLogger());
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
try {
exitCode = CommandLineUtils.executeCommandLine(cl, consumer, stderr);
} catch (CommandLineException ex) {
throw new ScmException("Error while executing command.", ex);
}
if (exitCode != 0) {
return new UpdateScmResult(cl.toString(), "The cvs command failed.", stderr.getOutput(), false);
}
return new UpdateScmResult(cl.toString(), consumer.getUpdatedFiles());
}
use of org.apache.maven.scm.command.update.UpdateScmResult in project maven-scm by apache.
the class AccuRevScmProvider method update.
@Override
protected UpdateScmResult update(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
AccuRevScmProviderRepository accurevRepo = (AccuRevScmProviderRepository) repository;
AccuRevUpdateCommand command = new AccuRevUpdateCommand(getLogger());
UpdateScmResult result = command.update(repository, fileSet, parameters);
if (result.isSuccess() && parameters.getBoolean(CommandParameter.RUN_CHANGELOG_WITH_UPDATE)) {
AccuRevUpdateScmResult accuRevResult = (AccuRevUpdateScmResult) result;
ScmRevision fromRevision = new ScmRevision(accuRevResult.getFromRevision());
ScmRevision toRevision = new ScmRevision(accuRevResult.getToRevision());
parameters.setScmVersion(CommandParameter.START_SCM_VERSION, fromRevision);
parameters.setScmVersion(CommandParameter.END_SCM_VERSION, toRevision);
AccuRevVersion startVersion = accurevRepo.getAccuRevVersion(fromRevision);
AccuRevVersion endVersion = accurevRepo.getAccuRevVersion(toRevision);
if (startVersion.getBasisStream().equals(endVersion.getBasisStream())) {
ChangeLogScmResult changeLogResult = changelog(repository, fileSet, parameters);
if (changeLogResult.isSuccess()) {
result.setChanges(changeLogResult.getChangeLog().getChangeSets());
} else {
getLogger().warn("Changelog from " + fromRevision + " to " + toRevision + " failed");
}
} else {
String comment = "Cross stream update result from " + startVersion + " to " + endVersion;
String author = "";
List<ScmFile> files = result.getUpdatedFiles();
List<ChangeFile> changeFiles = new ArrayList<ChangeFile>(files.size());
for (ScmFile scmFile : files) {
changeFiles.add(new ChangeFile(scmFile.getPath()));
}
ChangeSet dummyChangeSet = new ChangeSet(new Date(), comment, author, changeFiles);
// different streams invalidates the change log, insert a dummy change instead.
List<ChangeSet> changeSets = Collections.singletonList(dummyChangeSet);
result.setChanges(changeSets);
}
}
return result;
}
use of org.apache.maven.scm.command.update.UpdateScmResult in project maven-scm by apache.
the class UpdateSubprojectsMojo method execute.
/**
* {@inheritDoc}
*/
public void execute() throws MojoExecutionException {
super.execute();
try {
ScmRepository repository = getScmRepository();
UpdateScmResult result = getScmManager().update(repository, getFileSet(), getScmVersion(scmVersionType, scmVersion));
checkResult(result);
if (result instanceof UpdateScmResultWithRevision) {
getLog().info("Storing revision in '" + revisionKey + "' project property.");
if (// Remove the test when we'll use plugin-test-harness 1.0-alpha-2
project.getProperties() != null) {
project.getProperties().put(revisionKey, ((UpdateScmResultWithRevision) result).getRevision());
}
}
} catch (IOException e) {
throw new MojoExecutionException("Cannot run update command : ", e);
} catch (ScmException e) {
throw new MojoExecutionException("Cannot run update command : ", e);
}
}
use of org.apache.maven.scm.command.update.UpdateScmResult in project maven-scm by apache.
the class TfsScmProvider method update.
protected UpdateScmResult update(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
TfsUpdateCommand command = new TfsUpdateCommand();
command.setLogger(getLogger());
return (UpdateScmResult) command.execute(repository, fileSet, parameters);
}
Aggregations