Meta/cook: tweak "Will merge" marker automatically
Junio C Hamano committed
Feb 10, 2016 at 15:40 UTC
61a617dc09766a2fe07c6ad0c88963c64410031d
1 file changed
+31
cook
+31
@@ -450,6 +450,13 @@ sub write_cooking {
450
451
print $fh $lead, $d->{'desc'}, "\n";
452
if ($d->{'text'}) {
453
+ # Final clean-up. No leading or trailing
454
+ # blank lines, no multi-line gaps.
455
+ for ($d->{'text'}) {
456
+ s/^\n+//s;
457
+ s/\n{3,}/\n\n/s;
458
+ s/\n+$//s;
459
+ }
460
print $fh "\n", $d->{'text'}, "\n";
461
}
462
$lead = "\n\n";
@@ -509,6 +516,8 @@ sub update_issue {
516
blurb_text($mon, $year, $issue, $dow, $date,
517
$master_at, $next_at, $btext);
518
519
+ # If starting a new issue, move what used to be in
520
+ # new topics to cooking topics.
521
if (!$incremental) {
522
my $sd = $cooking->{'section_data'};
523
my $sl = $cooking->{'section_list'};
@@ -540,6 +549,11 @@ sub tweak_willdo {
549
my ($td) = @_;
550
my $desc = $td->{'desc'};
551
my $text = $td->{'text'};
552
+
553
+ # If updated description (i.e. the list of patches with
554
+ # merge trail to 'next') has 'merged to next', then
555
+ # tweak the topic to be slated to 'master'.
556
+ # NEEDSWORK: does this work correctly for a half-merged topic?
557
$desc =~ s/\n<<\n.*//s;
558
if ($desc =~ /^ \(merged to 'next'/m) {
559
$text =~ s/^ Will merge to 'next'\.$/ Will merge to 'master'./m;
@@ -547,11 +561,27 @@ sub tweak_willdo {
561
$td->{'text'} = $text;
562
}
563
564
+sub tweak_graduated {
565
+ my ($td) = @_;
566
+
567
+ # Remove the "Will merge" marker from topics that have graduated.
568
+ for ($td->{'text'}) {
569
+ s/\n Will merge to 'master'\.(\n|$)//s;
570
+ }
571
+}
572
+
573
sub merge_cooking {
574
my ($cooking, $current) = @_;
575
+
576
+ # A hash to find <desc, text> with a branch name or $blurb
577
my $td = $cooking->{'topic_description'};
578
+
579
+ # A hash to find a list of $td element given a section name
580
my $sd = $cooking->{'section_data'};
581
+
582
+ # A list of section names
583
my $sl = $cooking->{'section_list'};
584
+
585
my (@new_topic, @gone_topic);
586
587
# Make sure "New Topics" and "Graduated" exists
@@ -615,6 +645,7 @@ sub merge_cooking {
645
}
646
for (@gone_topic) {
647
push @{$sd->{$graduated}}, $_;
648
+ tweak_graduated($td->{$_});
649
}
650
}
651
}