Meta/cook: add -wildo option
This is to group and list the topics by scheduled graduation.
Junio C Hamano committed
Apr 27, 2011 at 12:39 UTC
d818c33cff4a32ad08a14906632911c931c5a437
1 file changed
+64
-16
cook
+64
-16
@@ -5,18 +5,6 @@ use strict;
5
6
my %reverts = ('next' => {
7
map { $_ => 1 } qw(
8
- c9bb83f
9
- 8f6d1e2
10
- 477e5a8
11
- cc17e9f
12
- 07b74a9
13
- e4b5259
14
- 76c7727
15
- 7e7b4f7
16
- 44d3770
17
- 107880a
18
- 02f9c7c
19
- a9ef3e3
8
) });
9
10
%reverts = ();
@@ -600,10 +588,70 @@ sub merge_cooking {
588
}
589
}
590
591
+################################################################
592
+# WilDo
593
+sub wildo {
594
+ my (%what, $topic, $last_merge_to_next);
595
+ my $too_recent = '9999-99-99';
596
+ while (<>) {
597
+ chomp;
598
+ if (/^\* (?:\S+) \(([-0-9]+)\) \d+ commits?$/) {
599
+ $topic = [$1, $too_recent, $_]; # tip-date, next-date, line
600
+ }
601
+ if (defined $topic &&
602
+ ($topic->[1] eq $too_recent) &&
603
+ (/^ \(merged to 'next' on ([-0-9]+)/)) {
604
+ $topic->[1] = $1;
605
+ }
606
+ next if (/^ /);
607
+ if (defined $topic &&
608
+ /Will (?:\S+ )?merge /i) {
609
+ if (!exists $what{$_}) {
610
+ $what{$_} = [];
611
+ }
612
+ push @{$what{$_}}, $topic;
613
+ $topic = undef;
614
+ }
615
+ }
616
+ my $ipbl = "";
617
+ for my $what (sort keys %what) {
618
+ print "$ipbl$what\n";
619
+ for $topic (map { $_->[2] }
620
+ sort { (($a->[1] cmp $b->[1]) ||
621
+ ($a->[0] cmp $b->[0])) }
622
+ @{$what{$what}}) {
623
+ print " $topic\n";
624
+ }
625
+ $ipbl = "\n";
626
+ }
627
+}
628
+
629
+################################################################
630
+# WhatsCooking
631
+
632
+sub doit {
633
+ my $topic = get_commit();
634
+ my $cooking = read_previous('Meta/whats-cooking.txt');
635
+ merge_cooking($cooking, $topic);
636
+ write_cooking('Meta/whats-cooking.txt', $cooking);
637
+}
638
+
639
################################################################
640
# Main
641
606
-my $topic = get_commit();
607
-my $cooking = read_previous('Meta/whats-cooking.txt');
608
-merge_cooking($cooking, $topic);
609
-write_cooking('Meta/whats-cooking.txt', $cooking);
642
+use Getopt::Long;
643
+
644
+my $wildo;
645
+if (!GetOptions("wildo" => \$wildo)) {
646
+ print STDERR "$0 [--wildo]";
647
+ exit 1;
648
+}
649
+
650
+if ($wildo) {
651
+ if (!@ARGV) {
652
+ push @ARGV, "Meta/whats-cooking.txt";
653
+ }
654
+ wildo();
655
+} else {
656
+ doit();
657
+}