#!/usr/bin/perl use Modern::Perl; use utf8::all; use Time::Moment; use Lingua::EN::Numbers::Ordinate; use IO::Prompt::Tiny qw/prompt/; use List::MoreUtils qw(uniq); use YAML qw(LoadFile DumpFile); # Get all commits from git my @commits = `git -c i18n.logOutputEncoding=UTF-8 log --pretty=format:"%H, %ct, %an, %ae"`; unless (@commits) { say 'Hum... no commits?'; exit 1; } my @history; # Convert commit lines to hashref keyed on epoch date # and record name -> email and email -> name maps my $seen_name = {}; my $seen_email = {}; my $commitref = {}; #say scalar @commits; for my $commit (@commits) { chomp $commit; my ( $commit_id, $commit_date, $author_name, $author_email ) = split( /,/, $commit ); my $name = lc( $author_name ); $name =~ s/([^\s\w]*)(\S+)/$1\u\L$2/g; $name =~ s/^\s+|\s+$//g; my $email = lc( $author_email ); $email =~ s/^\s+|\s+$//g; $seen_name->{$name}->{$email} = 1; $seen_email->{$email}->{$name} = 1; $commitref->{ $commit_id } = { name => $name, email => $email, date => $commit_date }; } my $contributors; my $total; for my $commit ( sort { $a->{date} <=> $b->{date} } ( values %{$commitref} ) ) { my $commit_name = $commit->{name}; my $author = $commit_name; $contributors->{$author}->{commits}++; $total++; } say "total=$total"; exit 0;