general_assembly.pl 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env perl
  2. use warnings;
  3. use strict;
  4. use POSIX qw(strftime);
  5. use Encode qw(decode);
  6. use Data::Dumper;
  7. sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s };
  8. my @shortlog = split /\n/, decode('UTF-8', `git log --pretty=format:"%aN <%aE>" --since="last 36 months" | sort | uniq -c | sort -r`, Encode::FB_CROAK);
  9. my %assembly = ();
  10. foreach my $line (@shortlog) {
  11. my ($count, $name, $email) = $line =~ m/^ *(\d+) *(.*?) <(.*?)>/;
  12. if ($count < 20) {
  13. next;
  14. }
  15. $name = trim $name;
  16. if ($count < 50) {
  17. my $true = 0;
  18. my @commits = split /(^|\n)commit [a-z0-9]{40}(\n|$)/, decode('UTF-8', `git log --name-only --use-mailmap --author="$email" --since="last 36 months"`, Encode::FB_CROAK);
  19. foreach my $commit (@commits) {
  20. $true++; # if ($commit =~ /\n[\w\/]+\.(c|h|S|asm|texi)/);
  21. }
  22. if ($true < 20) {
  23. next;
  24. }
  25. }
  26. $assembly{$name} = $email;
  27. }
  28. printf("# %s %s", strftime("%Y-%m-%d", localtime), decode('UTF-8', `git rev-parse HEAD`, Encode::FB_CROAK));
  29. foreach my $email (sort values %assembly) {
  30. printf("%s\n", $email);
  31. }