# File lib/gitlab_git/stats.rb, line 14 def commits_count @commits_count ||= repo.commit_count(ref) end
# File lib/gitlab_git/stats.rb, line 55 def build_graph(n = 4) from, to = (Date.today.prev_day(n*7)), Date.today args = ['--all', "--since=#{from.to_s}", '--format=%ad' ] rev_list = repo.git.native(:rev_list, {}, args).split("\n") commits_dates = rev_list.values_at(* rev_list.each_index.select {|i| i.odd?}) commits_dates = commits_dates.map { |date_str| Time.parse(date_str).to_date.to_s } commits_per_day = from.upto(to).map do |day| commits_dates.count(day.to_date.to_s) end OpenStruct.new( labels: from.upto(to).map { |day| day.strftime('%b %d') }, commits: commits_per_day, weeks: n ) end
Generated with the Darkfish Rdoc Generator 2.