From 61a617dc09766a2fe07c6ad0c88963c64410031d Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 10 Feb 2016 15:40:35 -0800 Subject: [PATCH] Meta/cook: tweak "Will merge" marker automatically --- cook | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/cook b/cook index 6045c63c78..e357f90ab9 100755 --- a/cook +++ b/cook @@ -450,6 +450,13 @@ sub write_cooking { print $fh $lead, $d->{'desc'}, "\n"; if ($d->{'text'}) { + # Final clean-up. No leading or trailing + # blank lines, no multi-line gaps. + for ($d->{'text'}) { + s/^\n+//s; + s/\n{3,}/\n\n/s; + s/\n+$//s; + } print $fh "\n", $d->{'text'}, "\n"; } $lead = "\n\n"; @@ -509,6 +516,8 @@ sub update_issue { blurb_text($mon, $year, $issue, $dow, $date, $master_at, $next_at, $btext); + # If starting a new issue, move what used to be in + # new topics to cooking topics. if (!$incremental) { my $sd = $cooking->{'section_data'}; my $sl = $cooking->{'section_list'}; @@ -540,6 +549,11 @@ sub tweak_willdo { my ($td) = @_; my $desc = $td->{'desc'}; my $text = $td->{'text'}; + + # If updated description (i.e. the list of patches with + # merge trail to 'next') has 'merged to next', then + # tweak the topic to be slated to 'master'. + # NEEDSWORK: does this work correctly for a half-merged topic? $desc =~ s/\n<<\n.*//s; if ($desc =~ /^ \(merged to 'next'/m) { $text =~ s/^ Will merge to 'next'\.$/ Will merge to 'master'./m; @@ -547,11 +561,27 @@ sub tweak_willdo { $td->{'text'} = $text; } +sub tweak_graduated { + my ($td) = @_; + + # Remove the "Will merge" marker from topics that have graduated. + for ($td->{'text'}) { + s/\n Will merge to 'master'\.(\n|$)//s; + } +} + sub merge_cooking { my ($cooking, $current) = @_; + + # A hash to find with a branch name or $blurb my $td = $cooking->{'topic_description'}; + + # A hash to find a list of $td element given a section name my $sd = $cooking->{'section_data'}; + + # A list of section names my $sl = $cooking->{'section_list'}; + my (@new_topic, @gone_topic); # Make sure "New Topics" and "Graduated" exists @@ -615,6 +645,7 @@ sub merge_cooking { } for (@gone_topic) { push @{$sd->{$graduated}}, $_; + tweak_graduated($td->{$_}); } } }