Skip to content

Commit 2bee5b8

Browse files
committed
Meta/cook: teach 'source' heuristics for GGG topics
1 parent d786c64 commit 2bee5b8

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

cook

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ sub get_source {
127127
my ($branch) = @_;
128128
my @id = ();
129129
my %msgs = ();
130+
my @msgs = ();
130131
my %source = ();
131132
my %skip_me = ();
132133

@@ -137,29 +138,53 @@ sub get_source {
137138
if (s/^message-id:\s*<(.*)>\s*$/$1/i) {
138139
my $msg = $_;
139140
$msgs{$msg} = [get_message_parent($msg)];
140-
if (!%source) {
141-
$source{$msg} = $msg;
142-
}
141+
push @msgs, $msg;
143142
}
144143
}
145144
close($fh);
146145

147146
# Collect parent messages that are not in the series,
148147
# as they are likely to be the cover letters.
149-
for my $msg (keys %msgs) {
148+
for my $msg (@msgs) {
150149
for my $parent (@{$msgs{$msg}}) {
151150
if (!exists $msgs{$parent}) {
152-
$source{$parent} = 1;
151+
$source{$parent}++;
153152
}
154153
}
155154
}
156155

156+
reduce_sources(\@msgs, \%msgs, \%source);
157+
157158
map {
158159
" source: <$_>";
159160
}
160161
(keys %source);
161162
}
162163

164+
sub reduce_sources {
165+
# Message-source specific hack
166+
my ($msgs_array, $msgs_map, $src_map) = @_;
167+
168+
# messages without parent, or a singleton patch
169+
if ((! %$src_map && @{$msgs_array}) || (@{$msgs_array} == 1)) {
170+
%{$src_map} = ($msgs_array->[0] => 1);
171+
return;
172+
}
173+
174+
# Is it from GGG?
175+
my @ggg_source = ();
176+
for my $msg (keys %$src_map) {
177+
if ($msg =~ /^pull\.[^@]*\.gitgitgadget\@/) {
178+
push @ggg_source, $msg;
179+
}
180+
}
181+
if (@ggg_source == 1) {
182+
%{$src_map} = ($ggg_source[0] => 1);
183+
return;
184+
}
185+
186+
}
187+
163188
=head1
164189
Inspect the current set of topics
165190
@@ -676,7 +701,7 @@ sub tweak_willdo {
676701

677702
if (!defined $mergetomaster) {
678703
my $master = `git describe $MASTER`;
679-
if ($master =~ /-rc\d+(-\d+-g[0-9a-f]+)?$/) {
704+
if ($master =~ /-rc(\d+)(-\d+-g[0-9a-f]+)?$/ && $1 != 0) {
680705
$mergetomaster = "Will cook in 'next'.";
681706
} else {
682707
$mergetomaster = "Will merge to '$MASTER'.";
@@ -844,7 +869,7 @@ sub wildo_match {
844869
# NEEDSWORK: unify with Reintegrate::annotate_merge
845870
if (/^Will (?:\S+ ){0,2}(fast-track|hold|keep|merge|drop|discard|cook|kick|defer|eject|be re-?rolled|wait)[,. ]/ ||
846871
/^Not urgent/ || /^Not ready/ || /^Waiting for / || /^Under discussion/ ||
847-
/^Can wait in / || /^Still / || /^Stuck / || /^On hold/ ||
872+
/^Can wait in / || /^Still / || /^Stuck / || /^On hold/ || /^Breaks / ||
848873
/^Needs? / || /^Expecting / || /^May want to / || /^Under review/) {
849874
return 1;
850875
}

0 commit comments

Comments
 (0)