use of org.apache.maven.scm.provider.accurev.command.update.AccuRevUpdateCommand 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;
}
Aggregations