From d40bd0ae3ea84c40dbf4c39a85047b85bccf0e3a Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 22 Feb 2023 16:48:31 +0000 Subject: [PATCH 1/2] dev-cmd/contributions: Fix single-user handling; be more verbose - `brew contributions --user=issyl0` was taking forever because it went through all maintainers first, because the conditionals were in the wrong order. - This was too quiet, far too quiet, for something that takes so long. - Now verbose mode tells you what repos it's scanning for a user. --- Library/Homebrew/dev-cmd/contributions.rb | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/dev-cmd/contributions.rb b/Library/Homebrew/dev-cmd/contributions.rb index 91a1ff26395c1..934e4682d4b45 100755 --- a/Library/Homebrew/dev-cmd/contributions.rb +++ b/Library/Homebrew/dev-cmd/contributions.rb @@ -58,7 +58,15 @@ def contributions 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 + + return ofail "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 @@ def contributions 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 @@ def scan_repositories(repos, person, args) 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), From 3d3369c542627fad88524f5f67d6e26de5e909ae Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 22 Feb 2023 17:02:22 +0000 Subject: [PATCH 2/2] dev-cmd/contributions.rb: odie Co-authored-by: Mike McQuaid --- Library/Homebrew/dev-cmd/contributions.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/contributions.rb b/Library/Homebrew/dev-cmd/contributions.rb index 934e4682d4b45..a95ff1a970910 100755 --- a/Library/Homebrew/dev-cmd/contributions.rb +++ b/Library/Homebrew/dev-cmd/contributions.rb @@ -66,7 +66,7 @@ def contributions return end - return ofail "CSVs not yet supported for the full list of maintainers at once." if args.csv? + 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, _|