Merge pull request #14767 from issyl0/fix-contributions-single-user

dev-cmd/contributions: Fix single-user handling; be more verbose
This commit is contained in:
Issy Long 2023-02-22 17:17:30 +00:00 committed by GitHub
commit 2e31653e69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,7 +58,15 @@ module Homebrew
args.repositories
end
return ofail "CSVs not yet supported for the full list of maintainers at once." if args.csv? && args.user.nil?
if args.user
user = args.user
results[user] = scan_repositories(repos, user, args)
puts "#{user} contributed #{total(results[user])} times #{time_period(args)}."
puts generate_csv(T.must(user), results[user]) if args.csv?
return
end
odie "CSVs not yet supported for the full list of maintainers at once." if args.csv?
maintainers = GitHub.members_by_team("Homebrew", "maintainers")
maintainers.each do |username, _|
@ -71,13 +79,6 @@ module Homebrew
results[username] = scan_repositories(repos, username, args)
puts "#{username} contributed #{total(results[username])} times #{time_period(args)}."
end
return unless args.user
user = args.user
results[user] = scan_repositories(repos, user, args)
puts "#{user} contributed #{total(results[user])} times #{time_period(args)}."
puts generate_csv(T.must(user), results[user]) if args.csv?
end
sig { params(repo: String).returns(Pathname) }
@ -139,6 +140,8 @@ module Homebrew
tap.full_name
end
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),
coauthorships: git_log_trailers_cmd(T.must(repo_path), "Co-authored-by", person, args),