3 LANG=C LC_ALL=C GIT_PAGER=cat
4 export LANG LC_ALL GIT_PAGER
6 tmpdir=/var/tmp/cook.$$
7 mkdir "$tmpdir" || exit
9 trap 'rm -fr "$tmpdir"' 0
11 git branch --merged "master" | sed -n -e 's/^..//' -e '/\//p' >"$tmp.in.master"
12 git branch --merged "pu" | sed -n -e 's/^..//' -e '/\//p' >"$tmp.in.pu"
14 comm -13 "$tmp.in.master" "$tmp.in.pu"
15 git branch --no-merged pu |
16 sed -n -e 's/^..//' -e '/\//p'
19 git log --first-parent --format="%H %ci" master..next |
20 sed -e 's/ [0-2][0-9]:[0-6][0-9]:[0-6][0-9] [-+][0-2][0-9][0-6][0-9]$//' >"$tmp.next"
21 git rev-list master..pu >"$tmp.commits.in.pu"
25 git rev-list --no-merges --topo-order "master..$1" --not $2 >"$tmp.list"
26 count=$(wc -l <"$tmp.list" | tr -d ' ')
27 label="* $1 ($(git show -s --format="%ai" $1 | sed -e 's/ .*//')) $count commit"
28 test "$count" = 1 || label="${label}s"
30 count=$(git rev-list "master..$1" | wc -l)
31 mcount=$(git rev-list "maint..$1" | wc -l)
32 if test $mcount = $count
45 if test -n "$lastfoundmerge"
47 if test "$lastfoundmerge" = "$merge"
54 mb=$(git merge-base $merge $commit)
55 if test "$mb" = "$commit"
57 merged=$at merged_with=$merge
63 lastfoundmerge=$merged_with
69 elif grep "$commit" "$tmp.commits.in.pu" >/dev/null
75 if test "$lasttimelabel" != "$thistimelabel"
77 with=$(git rev-parse --short $merged_with)
78 echo " (merged to 'next' on $thistimelabel at $with)"
79 lasttimelabel=$thistimelabel
81 git show -s --format=" $commitlabel %s" $commit
88 test -z "$description" || description="$description;"
99 others="$others and $other"
105 others="$others, $other"
109 description="$description $kind $others"
115 sed -n -e '/^ ..*/p' -e '/^\* /p' "$old" >"$tmp.old.nc"
116 sed -n -e '/^ ..*/p' -e '/^\* /p' "$new" >"$tmp.new.nc"
117 if cmp "$tmp.old.nc" "$tmp.new.nc" >/dev/null
130 git rev-list --no-merges "master..$b"
131 done <"$tmp.branches" | sort | uniq -d >"$tmp.shared"
135 b=$(git branch --contains "$shared" | sed -n -e 's/^..//' -e '/\//p')
137 done <"$tmp.shared" | sort -u >"$tmp.related"
142 related=$(grep " $b " "$tmp.related" | tr ' ' '\012' | sort -u | sed -e '/^$/d')
148 if test -n "$related"
152 test "$b" = "$r" && continue
153 based=$(git rev-list --no-merges $b..$r | wc -l | tr -d ' ')
154 bases=$(git rev-list --no-merges $r..$b | wc -l | tr -d ' ')
155 case "$based,$bases" in
157 same_as="$same_as$r "
160 based_on="$based_on$r "
163 used_by="$used_by$r "
173 format_branch "$b" "$based_on"
176 test -z "$same_as" || add_desc 'is same as' $same_as
177 test -z "$based_on" || add_desc 'uses' $based_on
178 test -z "$used_by" || add_desc 'is used by' $used_by
179 test -z "$forks" || add_desc 'is related to' $forks
181 test -z "$description" ||
182 echo " (this branch$description.)"
183 } >"$tmp.output.$serial"
185 serial=$(( $serial + 1 ))
186 done <"$tmp.branches" >"$tmp.output.toc"
188 eval $(date +"monthname=%b month=%m year=%Y date=%d dow=%a")
189 lead="whats/cooking/$year/$month"
192 git ls-tree -r --name-only HEAD "$lead" | tail -n 1
196 issue=$( expr "$issue" : '.*/0*\([1-9][0-9]*\)\.txt$' )
197 issue=$(( $issue + 1 ))
201 issue=$( printf "%02d" $issue )
202 mkdir -p "Meta/$lead"
206 git ls-tree -r --name-only HEAD "whats/cooking" | tail -n 1
209 # We may have a half-written one already.
211 if test -f "Meta/$lead/$issue.txt"
213 last="$lead/$issue.txt"
217 master_at=$(git rev-parse --verify refs/heads/master)
218 next_at=$(git rev-parse --verify refs/heads/next)
219 cat >"$tmp.output.blurb" <<EOF
220 To: git@vger.kernel.org
221 Subject: What's cooking in git.git ($monthname $year, #$issue; $dow, $date)
222 X-master-at: $master_at
225 What's cooking in git.git ($monthname $year, #$issue; $dow, $date)
226 --------------------------------------------------
228 Here are the topics that have been cooking. Commits prefixed with '-' are
229 only in 'pu' while commits prefixed with '+' are in 'next'. The ones
230 marked with '.' do not appear in any of the branches, but I am still
235 if test -z "$NO_TEMPLATE" && test -f "Meta/$last"
237 template="Meta/$last"
244 my $blurb = "b..l..u..r..b";
247 my $incremental = $ARGV[1] eq "yes";
248 my $last_empty = undef;
249 my (@section, %section, @branch, %branch, %description, @leader);
250 my $in_unedited_olde = 0;
253 if ($in_unedited_olde) {
255 $in_unedited_olde = 0;
259 $in_unedited_olde = 1;
262 if ($in_unedited_olde) {
266 if (defined $section && /^-{20,}$/) {
273 if (/^\[(.*)\]\s*$/) {
276 if ($section eq "New Topics" && !$incremental) {
277 $section = "Old New Topics";
279 if (!exists $section{$section}) {
280 push @section, $section;
281 $section{$section} = [];
285 if (defined $section && /^\* (\S+) /) {
288 if (!exists $branch{$branch}) {
289 push @branch, [$branch, $section];
290 $branch{$branch} = 1;
292 push @{$section{$section}}, $branch;
294 if (defined $branch) {
295 my $was_last_empty = $last_empty;
297 if (!exists $description{$branch}) {
298 $description{$branch} = [];
300 if ($was_last_empty) {
301 push @{$description{$branch}}, "\n";
303 push @{$description{$branch}}, $_;
307 if (open I, "<$tmp.output.toc") {
308 $section = "New Topics";
310 my ($branch, $oldserial) = /^(\S*) (\d+)$/;
311 next if (exists $branch{$branch});
312 if (!exists $section{$section}) {
313 # Have it at the beginning
314 unshift @section, $section;
315 $section{$section} = [];
317 push @{$section{$section}}, $branch;
318 push @branch, [$branch, $section];
319 $branch{$branch} = 1;
320 if (!exists $description{$branch}) {
321 $description{$branch} = [];
323 open II, "<$tmp.output.$oldserial";
325 push @{$description{$branch}}, $_;
332 while (0 <= @{$description{$blurb}}) {
333 my $last = pop @{$description{$blurb}};
334 if ($last =~ /^$/ || $last =~ /^-{20,}$/) {
337 push @{$description{$blurb}}, $last;
342 open O, ">$tmp.template.blurb";
343 for (@{$description{$blurb}}) {
348 open TOC, ">$tmp.template.toc";
350 for my $section (@section) {
351 for my $branch (@{$section{$section}}) {
352 print TOC "$branch $serial $section\n";
353 open O, ">$tmp.template.$serial";
354 for (@{$description{$branch}}) {
361 ' <"$template" "$tmp" "$incremental"
364 tail -n 1 "$tmp.template.toc" | read branch serial section && echo $serial
369 if test -z "$TO_STDOUT"
371 exec >"Meta/$lead/$issue.txt"
374 if test -s "$tmp.template.blurb"
376 sed -e '/^---------------*$/q' <"$tmp.output.blurb"
377 sed -e '1,/^---------------*$/d' <"$tmp.template.blurb"
379 cat "$tmp.output.blurb"
383 --------------------------------------------------
384 [Graduated to "master"]
386 while read branch oldserial section
388 test "$section" = 'Graduated to "master"' &&
389 test "$incremental" = no && continue
391 tip=$(git rev-parse --quiet --verify "refs/heads/$branch") || continue
392 mb=$(git merge-base master $tip)
393 test "$mb" = "$tip" || continue
394 if test -n "$current"
401 cat "$tmp.template.$oldserial"
402 done <"$tmp.template.toc"
405 while read branch oldserial section
407 found=$(grep "^$branch " "$tmp.output.toc") || continue
408 newserial=$(expr "$found" : '[^ ]* \(.*\)')
409 if test "$current" != "$section"
413 --------------------------------------------------
420 show_topic "$tmp.template.$oldserial" "$tmp.output.$newserial"
421 done <"$tmp.template.toc"