Skip to content

Commit

Permalink
Rework charting cache fetcher for git repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
iay committed Nov 4, 2016
1 parent 575b2f4 commit f1f5589
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions charting/fetch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,30 @@
use File::stat;
use Months;

$fn = '../xml/ukfederation-metadata.xml';
$fn2 = '../xml/ukfederation-stats.html';
# Call git on the products directory
my $git = "/usr/bin/env git -C ../../ukf-products";

$fn1 = 'aggregates/ukfederation-metadata.xml';
$fn2 = 'aggregates/ukfederation-stats.html';

foreach $month (@months) {
print "Fetching $month...";


# Find the commit immediately prior to the start of that month.
my $instant = "$month-01T00:00:00Z";
my $commit = `$git rev-list -n 1 --before=$instant master`;
chomp $commit;
print "$commit";

my $dest1 = "cache/$month.xml";
if (!-e $dest1) {
system("/usr/bin/env svn update $fn --quiet --revision \\{$month-01T00:00:00Z\\}");
system("cp $fn $dest1");
system("$git show $commit:$fn1 >$dest1");
}

my $dest2 = "cache/$month.html";
if (!-e $dest2) {
system("/usr/bin/env svn update $fn2 --quiet --revision \\{$month-01T00:00:00Z\\}");
system("cp $fn2 $dest2");
system("$git show $commit:$fn2 >$dest2");
}

print "\n";
}

0 comments on commit f1f5589

Please sign in to comment.