/
files-over-time.pl
65 lines (51 loc) · 1.09 KB
/
files-over-time.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/perl
require "./stats/tag2date.pm";
sub num {
my ($t)=@_;
if($t =~ /^curl-(\d)_(\d+)_(\d+)/) {
return 10000*$1 + 100*$2 + $3;
}
elsif($t =~ /^curl-(\d)_(\d+)/) {
return 10000*$1 + 100*$2;
}
}
sub sortthem {
return num($a) <=> num($b);
}
@alltags= `git tag -l`;
foreach my $t (@alltags) {
chomp $t;
if($t =~ /^curl-([0-9_]*[0-9])\z/) {
push @releases, $t;
}
}
sub filecount {
my ($tag, $pref)=@_;
my $count;
open(G, "git ls-tree -r --name-only $tag -- $pref 2>/dev/null|");
my @file=<G>;
close(G);
return scalar(@file);
}
my @this = sort sortthem @releases;
my $now = `git describe`;
chomp $now;
# top off with the current state
push @this, $now;
foreach my $t (@this) {
my $c = filecount($t);
my $testsonly = filecount($t, "tests");
if($c) {
# prettify
my $d;
my $d = tag2date($t);
if($t ne $now) {
$t =~ s/_/./g;
$t =~ s/-/ /g;
}
else {
$t = "now";
}
printf "$d;$c;%u\n", $c-$testsonly;
}
}