コード例 #1
0
    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();
        }
      }
    }
コード例 #2
0
  private static void addChangeset(Builder scmBuilder, BlameLine line) {
    BatchReport.Changesets.Changeset.Builder changesetBuilder =
        BatchReport.Changesets.Changeset.newBuilder();
    changesetBuilder.setRevision(line.revision());
    changesetBuilder.setDate(line.date().getTime());
    if (StringUtils.isNotBlank(line.author())) {
      changesetBuilder.setAuthor(normalizeString(line.author()));
    }

    scmBuilder.addChangeset(changesetBuilder.build());
  }
コード例 #3
0
 @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);
 }