def get()

in src/main/scala/com/googlesource/gerrit/plugins/analytics/common/UserActivityHistogram.scala [24:37]


  def get(repo: Repository, filter: AbstractCommitHistogramFilter) = {
    val finder = new CommitFinder(repo)

    try {
      finder.setFilter(filter).find
      val histogram = filter.getHistogram
      histogram.getAggregatedUserActivity
    } catch {
      // 'find' throws an IllegalArgumentException when the conditions to walk through the commits tree are not met,
      // i.e: an empty repository doesn't have the starting commit.
      case _: IllegalArgumentException => Array.empty[AggregatedUserCommitActivity]
      case e: Exception => throw new PreconditionFailedException(s"Cannot find commits: ${e.getMessage}").initCause(e)
    }
  }