cook.sh: move the "New Topics" generation to the template handler code

Junio C Hamano committed Aug 23, 2009 at 17:05 UTC f4c0a9a353262f0a7d90e0f99740a6e81307cab6
1 file changed +23 -9
cook.sh
+23 -9
@@ -287,6 +287,29 @@ perl -w -e '
287 }
288 }
289
290 + if (open I, "<$tmp.output.toc") {
291 + $section = "New Topics";
292 + while (<I>) {
293 + my ($branch, $oldserial) = /^(\S*) (\d+)$/;
294 + next if (exists $branch{$branch});
295 + if (!exists $section{$section}) {
296 + push @section, $section;
297 + $section{$section} = [];
298 + }
299 + push @branch, [$branch, $section];
300 + $branch{$branch} = (scalar @branch) - 1;
301 + if (!exists $description{$branch}) {
302 + $description{$branch} = [];
303 + }
304 + open II, "<$tmp.output.$oldserial";
305 + while (<II>) {
306 + push @{$description{$branch}}, $_;
307 + }
308 + close II;
309 + }
310 + close I;
311 + }
312 +
313 open O, ">$tmp.template.blurb";
314 for (@{$description{$blurb}}) {
315 print O $_;
@@ -326,15 +349,6 @@ else
349 cat "$tmp.output.blurb"
350 fi | sed -e '$d'
351
329 -while read branch serial
330 -do
331 - grep "^$branch " "$tmp.template.toc" >/dev/null && continue
332 -
333 - tmpserial=$(( $tmpserial + 1 ))
334 - echo "$branch $tmpserial New Topics" >>"$tmp.template.toc"
335 - cp "$tmp.output.$serial" "$tmp.template.$tmpserial"
336 -done <"$tmp.output.toc"
337 -
352 current='--------------------------------------------------
353 [Graduated to "master"]
354 '