in maven-scm-api/src/main/java/org/apache/maven/scm/command/update/AbstractUpdateCommand.java [45:104]
protected abstract UpdateScmResult executeUpdateCommand(
ScmProviderRepository repository, ScmFileSet fileSet, ScmVersion scmVersion) throws ScmException;
/** {@inheritDoc} */
public ScmResult executeCommand(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters)
throws ScmException {
ScmVersion scmVersion = parameters.getScmVersion(CommandParameter.SCM_VERSION, null);
boolean runChangelog = Boolean.valueOf(parameters.getString(CommandParameter.RUN_CHANGELOG_WITH_UPDATE, "true"))
.booleanValue();
UpdateScmResult updateScmResult = executeUpdateCommand(repository, fileSet, scmVersion);
List<ScmFile> filesList = updateScmResult.getUpdatedFiles();
if (!runChangelog) {
return updateScmResult;
}
ChangeLogCommand changeLogCmd = getChangeLogCommand();
if (filesList != null && filesList.size() > 0 && changeLogCmd != null) {
ChangeLogScmResult changeLogScmResult =
(ChangeLogScmResult) changeLogCmd.executeCommand(repository, fileSet, parameters);
List<ChangeSet> changes = new ArrayList<ChangeSet>();
ChangeLogSet changeLogSet = changeLogScmResult.getChangeLog();
if (changeLogSet != null) {
Date startDate = null;
try {
startDate = parameters.getDate(CommandParameter.START_DATE);
} catch (ScmException e) {
// Do nothing, startDate isn't define.
}
for (ChangeSet change : changeLogSet.getChangeSets()) {
if (startDate != null && change.getDate() != null) {
if (startDate.after(change.getDate())) {
continue;
}
}
for (ScmFile currentFile : filesList) {
if (change.containsFilename(currentFile.getPath())) {
changes.add(change);
break;
}
}
}
}
updateScmResult.setChanges(changes);
}
return updateScmResult;
}