private void processScm(@Nullable BatchReport.Changesets scm) { if (scm == null) { return; } for (BatchReport.Changesets.Changeset changeset : scm.getChangesetList()) { if (changeset.hasDate() && changeset.getDate() > lastCommitTimestampFromReport) { lastCommitTimestampFromReport = changeset.getDate(); } } }
@Override public void visitFile(Component file, Path<LastCommit> path) { // load SCM blame information from report. It can be absent when the file was not touched // since previous analysis (optimization to decrease execution of blame commands). In this case // the date is loaded from database, as it did not change from previous analysis. BatchReport.Changesets changesets = reportReader.readChangesets(file.getReportAttributes().getRef()); if (changesets == null) { Optional<Measure> baseMeasure = measureRepository.getBaseMeasure(file, lastCommitDateMetric); if (baseMeasure.isPresent()) { path.current().addDate(baseMeasure.get().getLongValue()); } } else { for (BatchReport.Changesets.Changeset changeset : changesets.getChangesetList()) { if (changeset.hasDate()) { path.current().addDate(changeset.getDate()); } } } saveAndAggregate(file, path); }