What's cooking (2012/07 #09)
[git.git] / candidates
blob449041aed85fa4b2bcb4101ef34c1fc880b35dc8
1 #!/usr/bin/perl
2 # Feed whats-cooking to this to find what to merge to 'master'
4 sub merged {
5 my ($topic, $base) = @_;
6 my $fh;
7 (open $fh, "-|", qw(git rev-list), "^$base", $topic)
8 or die "$!";
9 my $count = 0;
10 while (<$fh>) {
11 $count++;
13 (close $fh)
14 or die "$! (after $count for $topic)";
15 return $count;
18 my ($topic, $topic_date, $last);
19 my (@candidate);
21 while (<>) {
22 if (/^\* ([a-z][a-z]\/[-a-zA-Z0-9_]+) \(([-0-9]{10})\) \d+ commit/) {
23 $topic = $last = $1;
24 $topic_date = $2;
25 next;
27 if (defined $topic) {
28 if (/^ \(merged to 'next' on ([-0-9]{10}) at/) {
29 push @candidate, [$topic, $1, $topic_date, ""];
30 next;
32 $topic = undef;
33 $topic_date = undef;
35 if (defined $last && @candidate && $candidate[-1][0] eq $last) {
36 if (/Will merge to 'master'/i) {
37 $candidate[-1][3] = "*";
42 for $topic (sort { ($a->[1] cmp $b->[1]) || ($a->[2] cmp $b->[2]) } @candidate) {
43 my $count = merged($topic->[0], 'master');
44 if ($count) {
45 print "$topic->[1] $topic->[2] ($count) $topic->[3]$topic->[0]\n";