diff --git a/Library/Homebrew/dev-cmd/contributions.rb b/Library/Homebrew/dev-cmd/contributions.rb index d7fbf333f0..e6df85892b 100755 --- a/Library/Homebrew/dev-cmd/contributions.rb +++ b/Library/Homebrew/dev-cmd/contributions.rb @@ -108,7 +108,7 @@ module Homebrew sig { params(totals: Hash).returns(String) } def generate_maintainers_csv(totals) CSV.generate do |csv| - csv << %w[user repo commits coauthorships reviews total] + csv << %w[user repo author committer coauthorships reviews total] totals.sort_by { |_, v| -v.values.sum }.each do |user, total| csv << grand_total_row(user, total) @@ -119,12 +119,13 @@ module Homebrew sig { params(user: String, results: Hash, grand_total: Hash).returns(String) } def generate_csv(user, results, grand_total) CSV.generate do |csv| - csv << %w[user repo commits coauthorships reviews total] + csv << %w[user repo author committer coauthorships reviews total] results.each do |repo, counts| csv << [ user, repo, - counts[:commits], + counts[:author], + counts[:committer], counts[:coauthorships], counts[:reviews], counts.values.sum, @@ -139,7 +140,8 @@ module Homebrew [ user, "all", - grand_total[:commits], + grand_total[:author], + grand_total[:committer], grand_total[:coauthorships], grand_total[:reviews], grand_total.values.sum, @@ -170,7 +172,8 @@ module Homebrew puts "Determining contributions for #{person} on #{repo_full_name}..." if args.verbose? data[repo] = { - commits: GitHub.repo_commit_count_for_user(repo_full_name, person, args), + author: GitHub.repo_commit_count_for_user(repo_full_name, person, "author", args), + committer: GitHub.repo_commit_count_for_user(repo_full_name, person, "committer", args), coauthorships: git_log_trailers_cmd(T.must(repo_path), person, "Co-authored-by", args), reviews: GitHub.count_issues( "", @@ -188,7 +191,7 @@ module Homebrew sig { params(results: Hash).returns(Hash) } def total(results) - totals = { commits: 0, coauthorships: 0, reviews: 0 } + totals = { author: 0, committer: 0, coauthorships: 0, reviews: 0 } # { # "brew"=>{:commits=>9,:coauthorships=>6,:reviews=>1}, diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index 6e04b3548d..d4bf5b7027 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -717,10 +717,10 @@ module GitHub output[/^Status: (200)/, 1] != "200" end - def repo_commit_count_for_user(nwo, user, args) + def repo_commit_count_for_user(nwo, user, filter, args) return if Homebrew::EnvConfig.no_github_api? - params = ["author=#{user}"] + params = ["#{filter}=#{user}"] params << "since=#{DateTime.parse(args.from).iso8601}" if args.from params << "until=#{DateTime.parse(args.to).iso8601}" if args.to