Meta/cook: fix recent breakage of the listing
Recent addition of "source:" support broke listing of topics in other sections. Those that have wildo keywords were flushing too soon, before the sources were read.
Junio C Hamano committed
Jul 12, 2024 at 15:48 UTC
e5448756a94126ac8c88091ca8e9277de3dd5a8a
1 file changed
+23
-33
cook
+23
-33
@@ -834,31 +834,16 @@ sub merge_cooking {
834
################################################################
835
# WilDo
836
sub wildo_queue {
837
- my ($what, $action, $topic) = @_;
838
- if (!exists $what->{$action}) {
839
- $what->{$action} = [];
840
- }
841
- push @{$what->{$action}}, $topic;
842
-}
843
-
844
-sub section_action {
845
- my ($section) = @_;
846
- if ($section) {
847
- for ($section) {
848
- return if (/^Graduated to/ || /^Discarded$/);
849
- return $_ if (/^Stalled$/);
850
- }
851
- }
852
- return "Undecided";
853
-}
854
-
855
-sub wildo_flush_topic {
837
my ($in_section, $what, $topic) = @_;
838
if (defined $topic) {
858
- my $action = section_action($in_section);
859
- if ($action) {
860
- wildo_queue($what, $action, $topic);
839
+ for ($in_section) {
840
+ return if (/^Graduated to/ || /^Discarded$/);
841
}
842
+ my $action = $topic->[6] || "Under discussion";
843
+ if (!exists $what->{$action}) {
844
+ $what->{$action} = [];
845
+ }
846
+ push @{$what->{$action}}, $topic;
847
}
848
}
849
@@ -883,16 +868,22 @@ sub wildo {
868
if (/^\[(.*)\]$/) {
869
my $old_section = $in_section;
870
$in_section = $1;
886
- wildo_flush_topic($old_section, \%what, $topic);
871
+ wildo_queue($old_section, \%what, $topic);
872
$topic = $in_desc = undef;
873
next;
874
}
875
876
if (/^\* (\S+) \(([-0-9]+)\) (\d+) commits?$/) {
892
- wildo_flush_topic($in_section, \%what, $topic);
893
-
894
- # tip-date, next-date, topic, count, seen-count
895
- $topic = [$2, $too_recent, $1, $3, 0];
877
+ wildo_queue($in_section, \%what, $topic);
878
+
879
+ # [0] tip-date
880
+ # [1] next-date
881
+ # [2] topic
882
+ # [3] count
883
+ # [4] seen-count
884
+ # [5] source
885
+ # [6] action
886
+ $topic = [$2, $too_recent, $1, $3, 0, [], undef];
887
$in_desc = undef;
888
next;
889
}
@@ -922,19 +913,18 @@ sub wildo {
913
}
914
915
if (wildo_match($_)) {
925
- wildo_queue(\%what, $_, $topic);
916
+ $topic->[6] = $_;
917
next;
918
}
919
929
- if (/^source:\s+(.*)$/) {
920
+ if (/^(?:source:|cf\.)\s+(.*)$/) {
921
$topic->[5] ||= [];
922
push @{$topic->[5]}, $1;
932
- $topic = $in_desc = undef;
923
next;
924
}
925
926
}
937
- wildo_flush_topic($in_section, \%what, $topic);
927
+ wildo_queue($in_section, \%what, $topic);
928
929
my $ipbl = "";
930
for my $what (sort keys %what) {
@@ -954,12 +944,12 @@ sub wildo {
944
}
945
$count = "#$count";
946
printf " %s %-60s %s%s %5s\n", $sign, $name, $tip, $next, $count;
957
- if ($what !~ /^Will /) {
947
+ if ($what !~ /^Will merge to '\w+'\.$/) {
948
for my $s (@$source) {
949
if ($s =~ /^<(.*)>$/) {
950
$s = "https://lore.kernel.org/git/$1/";
951
}
962
- printf " $s\n";
952
+ printf " $s\n";
953
}
954
}
955
}