Meta/Reintegrate: use older editions of what's cooking report as needed
When down-merging old topics that graduated to 'master' some time ago to maintenance tracks, Meta/whats-cooking.txt that is checked out would no longer have the release notes entry for the topics. Look for recent editions of what's cooking report in such a case.
Junio C Hamano committed
Feb 24, 2015 at 21:53 UTC
47f8a44dd7296d34825aa0998f3adea948685bca
1 file changed
+39
-20
Reintegrate
+39
-20
@@ -36,28 +36,47 @@ annotate_merge () {
36
return 0;
37
}
38
39
- my ($branch) = $ARGV[0];
40
- my ($in_section, $in_desc);
41
- my @msg = ();
42
- while (<STDIN>) {
43
- chomp;
44
- if (/^\* $branch /) {
45
- $in_section = 1;
46
- next;
47
- }
48
- last if (/^[-*\[]/ && $in_section);
49
- next unless $in_section;
50
- s/^\s+//;
51
- if (/^$/) {
52
- $in_desc = 1;
39
+ sub read_message {
40
+ my ($fh, $branch) = @_;
41
+ my ($in_section, $in_desc);
42
+ my @msg = ();
43
+ while (<$fh>) {
44
+ chomp;
45
+ if (/^\* $branch /) {
46
+ $in_section = 1;
47
+ next;
48
+ }
49
+ last if (/^[-*\[]/ && $in_section);
50
+ next unless $in_section;
51
+ s/^\s+//;
52
+ if (/^$/) {
53
+ $in_desc = 1;
54
+ }
55
+ next unless ($in_section && $in_desc);
56
+ next if (/Originally merged to '\''next'\'' on ([-0-9]+)/);
57
+ next if (wildo_match($_));
58
+ push @msg, "$_\n";
59
}
54
- next unless ($in_section && $in_desc);
55
- next if (/Originally merged to '\''next'\'' on ([-0-9]+)/);
56
- next if (wildo_match($_));
57
- push @msg, "$_\n";
60
+ return ($in_section, @msg);
61
}
62
60
- if ($in_section && @msg) {
63
+ my ($branch) = $ARGV[0];
64
+ my ($fh, $in_section, @msg);
65
+ if (open $fh, "<", "Meta/whats-cooking.txt") {
66
+ ($in_section, @msg) = read_message($fh, $branch);
67
+ }
68
+ if (!@msg) {
69
+ open my $revs, "-|",
70
+ qw(git -C Meta rev-list -32 HEAD -- whats-cooking.txt);
71
+ while (my $rev = <$revs>) {
72
+ chomp($rev);
73
+ open $fh, "-|",
74
+ qw(git -C Meta cat-file blob), "$rev:whats-cooking.txt";
75
+ ($in_section, @msg) = read_message($fh, $branch);
76
+ last if (@msg);
77
+ }
78
+ }
79
+ if (@msg) {
80
open(my $fh, "-|", qw(git cat-file commit HEAD));
81
my @original = (<$fh>);
82
close $fh;
@@ -86,7 +105,7 @@ annotate_merge () {
105
print $fh @final;
106
close $fh;
107
}
89
- ' <Meta/whats-cooking.txt "$1"
108
+ ' "$1"
109
}
110
111
case "$generate" in