5 use Data::Dump qw(dump);
8 /home/dpavlin/dell-switch/running-config/
9 /home/dpavlin/mikrotik-switch/backup/
10 /home/dpavlin/tilera/backup/
13 my $debug = $ENV{DEBUG} || 0;
16 open(my $less, '|-', "less -R -S");
27 die "ERROR on $repo in ",dump($fh) unless $r;
29 if ( m/(\e\[\d*m)?commit [0-9a-f]+/ ) {
30 #if ( m/commit [0-9a-f]+/ ) {
31 if ( ! defined $commit->{$repo} ) { # first time, read commit
32 $commit->{$repo} = $_;
33 warn "## first commit ",dump($_) if $debug;
35 $commit_next->{$repo} = $_;
36 warn "## --------------" if $debug;
39 } elsif (m/Date:\s+([0-9-\+: ]+)/ ) {
40 $date_commit->{$1} = $repo;
41 warn "# $repo $1" if $debug;
42 $commit->{$repo} .= $_;
44 $commit->{$repo} .= $_;
45 warn "## $repo $. ",dump($_) if $debug;
50 foreach my $repo ( @repos ) {
52 open(my $r, '-|', "git -C $repo log --date=iso --color @ARGV");
59 #warn "# date_commit = ",dump($date_commit);
60 my $date = ( sort { $b cmp $a } keys %$date_commit )[0];
61 my $repo = $date_commit->{$date};
62 print "# $date $repo\n$commit->{$repo}";
63 $commit->{$repo} = $commit_next->{$repo};
64 delete $date_commit->{$date};