Skip to content

Instantly share code, notes, and snippets.

@earino
Created January 16, 2014 03:35
Show Gist options
  • Save earino/8449365 to your computer and use it in GitHub Desktop.
Save earino/8449365 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use warnings;
use strict;
use Data::Dumper;
my @records = ();
my $now = time();
my $weeks = 604800 * 52;
my %authors = ();
my @all_changes = ( );
while (<>) {
next unless /^commit/;
my $author = <> || last;
my $date = <> || last;
#Date: 1278055939 -0700
my ($dt) = $date =~ /Date:\s+(\d+)/;
if ($dt < $now - $weeks) {
next;
}
<> || last;
my $log = <> || last;
<> || last;
my $line = <> || last;
my @changes = ( );
while ($line =~ /^\d/) {
push (@changes, $line);
$line = <> || last;
}
chomp($author, $date, $log);
chomp(@changes);
push (@all_changes, @changes);
$authors{$author}++;
push (@records, {
author => $author,
date => $date,
log => $log,
changes => \@changes,
});
}
print Dumper \@all_changes;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment