]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Meta/candidates: show number of patches in candidate topics
authorJunio C Hamano <gitster@pobox.com>
Thu, 8 Jul 2010 14:55:01 +0000 (07:55 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Jul 2010 14:55:01 +0000 (07:55 -0700)
candidates [new file with mode: 0755]

diff --git a/candidates b/candidates
new file mode 100755 (executable)
index 0000000..549e632
--- /dev/null
@@ -0,0 +1,43 @@
+#!/usr/bin/perl
+# Feed whats-cooking to this to find what to merge to 'master'
+
+sub merged {
+       my ($topic, $base) = @_;
+       my $fh;
+       (open $fh, "-|", qw(git rev-list), "^$base", $topic)
+           or die "$!";
+       my $count = 0;
+       while (<$fh>) {
+               $count++;
+       }
+       (close $fh)
+           or die "$! (after $count for $topic)";
+       return $count;
+}
+
+my ($topic, $topic_date);
+my (@candidate);
+
+while (<>) {
+       if (/^\* ([a-z][a-z]\/[-a-z0-9_]+) \(([-0-9]{10})\) \d+ commit/) {
+               $topic = $1;
+               $topic_date = $2;
+               next;
+       }
+       if (defined $topic) {
+               if (/^  \(merged to 'next' on ([-0-9]{10}) at/) {
+                       push @candidate, [$topic, $1, $topic_date];
+                       next;
+               }
+               $topic = undef;
+               $topic_date = undef;
+       }
+}
+
+for $topic (sort { ($a->[1] cmp $b->[1]) || ($a->[2] cmp $b->[2]) } @candidate) {
+       my $count = merged($topic->[0], 'master');
+       if ($count) {
+               print "$topic->[1] $topic->[2] ($count) $topic->[0]\n";
+       }
+}
+