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"
38 if test -n "$lastfoundmerge"
40 if test "$lastfoundmerge" = "$merge"
47 mb
=$
(git merge-base
$merge $commit)
48 if test "$mb" = "$commit"
50 merged
=$at merged_with
=$merge
56 lastfoundmerge
=$merged_with
62 elif grep "$commit" "$tmp.commits.in.pu" >/dev
/null
68 if test "$lasttimelabel" != "$thistimelabel"
70 with
=$
(git rev-parse
--short $merged_with)
71 echo " (merged to 'next' on $thistimelabel at $with)"
72 lasttimelabel
=$thistimelabel
74 git show
-s --format=" $commitlabel %s" $commit
81 test -z "$description" || description
="$description;"
87 "#EPO-"*) other
="early parts of ${other#"#EPO-"}"
95 others
="$others and $other"
101 others
="$others, $other"
105 description
="$description $kind $others"
111 sed -n -e '/^ ..*/p' -e '/^\* /p' "$old" >"$tmp.old.nc"
112 sed -n -e '/^ ..*/p' -e '/^\* /p' "$new" >"$tmp.new.nc"
113 if cmp "$tmp.old.nc" "$tmp.new.nc" >/dev
/null
124 # List commits that are shared between more than one topic branches
127 git rev-list
--no-merges "master..$b"
128 done <"$tmp.branches" |
sort |
uniq -d >"$tmp.shared"
130 # Set of branches related to each other due to sharing the same commit
133 b
=$
(git branch
--contains "$shared" |
sed -n -e 's/^..//' -e '/\//p')
135 done <"$tmp.shared" |
sort -u >"$tmp.related"
140 related
=$
(grep " $b " "$tmp.related" |
tr ' ' '\012' |
sort -u |
sed -e '/^$/d')
142 based_on
= based_on_msg
=
146 if test -n "$related"
150 test "$b" = "$r" && continue
151 based
=$
(git rev-list
--no-merges $b..
$r |
wc -l |
tr -d ' ')
152 bases
=$
(git rev-list
--no-merges $r..
$b |
wc -l |
tr -d ' ')
153 case "$based,$bases" in
155 same_as
="$same_as$r "
158 based_on
="$based_on$r "
159 based_on_msg
="$based_on_msg$r "
162 used_by
="$used_by$r "
165 if test $based -lt $bases
167 based_on
="$based_on$r "
168 based_on_msg
="${based_on_msg}#EPO-$r "
178 format_branch
"$b" "$based_on"
181 test -z "$same_as" || add_desc
'is same as' $same_as
182 test -z "$based_on" || add_desc
'uses' $based_on_msg
183 test -z "$used_by" || add_desc
'is used by' $used_by
184 test -z "$forks" || add_desc
'shares commits with' $forks
186 test -z "$description" ||
187 echo " (this branch$description.)"
188 } >"$tmp.output.$serial"
190 serial
=$
(( $serial + 1 ))
191 done <"$tmp.branches" >"$tmp.output.toc"
193 eval $
(date +"monthname=%b month=%m year=%Y date=%d dow=%a")
197 if git
diff --quiet --no-ext-diff HEAD
-- whats-cooking.txt
>/dev
/null
205 # Find the current issue
206 eval $
(sed -ne '/^Subject: /{
207 s/^Subject: What.s cooking in git.git (\([A-Z][a-z][a-z]\) \([0-9][0-9][0-9][0-9]\), #\([0-9][0-9]*\); [A-Z][a-z][a-z], [0-9][0-9])$/lastmon=\1 lastyear=\2 lastissue=\3/p
209 }' Meta
/whats-cooking.txt
)
210 if test "$monthname $year" = "$lastmon $lastyear"
212 if test "$incremental" = no
214 issue
=$
(( $lastissue + 1 ))
216 issue
=$
(( lastissue
+ 0 ))
222 issue
=$
( printf "%02d" $issue )
223 last
=whats-cooking.txt
225 master_at
=$
(git rev-parse
--verify refs
/heads
/master
)
226 next_at
=$
(git rev-parse
--verify refs
/heads
/next
)
227 cat >"$tmp.output.blurb" <<EOF
228 To: git@vger.kernel.org
229 Subject: What's cooking in git.git ($monthname $year, #$issue; $dow, $date)
230 X-master-at: $master_at
233 What's cooking in git.git ($monthname $year, #$issue; $dow, $date)
234 --------------------------------------------------
236 Here are the topics that have been cooking. Commits prefixed with '-' are
237 only in 'pu' while commits prefixed with '+' are in 'next'. The ones
238 marked with '.' do not appear in any of the branches, but I am still
243 if test -z "$NO_TEMPLATE" && test -f "Meta/$last"
245 template
="Meta/$last"
252 my $blurb = "b..l..u..r..b";
255 my $incremental = $ARGV[1] eq "yes";
256 my $last_empty = undef;
257 my (@section, %section, @branch, %branch, %description, @leader);
258 my $in_unedited_olde = 0;
261 if ($in_unedited_olde) {
263 $in_unedited_olde = 0;
267 $in_unedited_olde = 1;
270 if ($in_unedited_olde) {
274 if (defined $section && /^-{20,}$/) {
281 if (/^\[(.*)\]\s*$/) {
284 if ($section eq "New Topics" && !$incremental) {
285 $section = "Old New Topics";
287 if (!exists $section{$section}) {
288 push @section, $section;
289 $section{$section} = [];
293 if (defined $section && /^\* (\S+) /) {
296 if (!exists $branch{$branch}) {
297 push @branch, [$branch, $section];
298 $branch{$branch} = 1;
300 push @{$section{$section}}, $branch;
302 if (defined $branch) {
303 my $was_last_empty = $last_empty;
305 if (!exists $description{$branch}) {
306 $description{$branch} = [];
308 if ($was_last_empty) {
309 push @{$description{$branch}}, "\n";
311 push @{$description{$branch}}, $_;
315 if (open I, "<$tmp.output.toc") {
316 $section = "New Topics";
318 my ($branch, $oldserial) = /^(\S*) (\d+)$/;
319 next if (exists $branch{$branch});
320 if (!exists $section{$section}) {
321 # Have it at the beginning
322 unshift @section, $section;
323 $section{$section} = [];
325 push @{$section{$section}}, $branch;
326 push @branch, [$branch, $section];
327 $branch{$branch} = 1;
328 if (!exists $description{$branch}) {
329 $description{$branch} = [];
331 open II, "<$tmp.output.$oldserial";
333 push @{$description{$branch}}, $_;
340 while (0 <= @{$description{$blurb}}) {
341 my $last = pop @{$description{$blurb}};
342 if ($last =~ /^$/ || $last =~ /^-{20,}$/) {
345 push @{$description{$blurb}}, $last;
350 open O, ">$tmp.template.blurb";
351 for (@{$description{$blurb}}) {
356 open TOC, ">$tmp.template.toc";
358 for my $section (@section) {
359 for my $branch (@{$section{$section}}) {
360 print TOC "$branch $serial $section\n";
361 open O, ">$tmp.template.$serial";
362 for (@{$description{$branch}}) {
369 ' <"$template" "$tmp" "$incremental"
372 tail -n 1 "$tmp.template.toc" |
373 read branch serial section
&&
379 if test -z "$TO_STDOUT"
381 exec >"Meta/whats-cooking.txt"
384 if test -s "$tmp.template.blurb"
386 sed -e '/^---------------*$/q' <"$tmp.output.blurb"
387 sed -e '1,/^---------------*$/d' <"$tmp.template.blurb"
389 cat "$tmp.output.blurb"
393 --------------------------------------------------
394 [Graduated to "master"]
396 while read branch oldserial section
398 test "$section" = 'Graduated to "master"' &&
399 test "$incremental" = no
&& continue
401 tip
=$
(git rev-parse
--quiet --verify "refs/heads/$branch") ||
continue
402 mb
=$
(git merge-base master
$tip)
403 test "$mb" = "$tip" ||
continue
404 if test -n "$current"
411 cat "$tmp.template.$oldserial"
412 done <"$tmp.template.toc"
415 while read branch oldserial section
417 found
=$
(grep "^$branch " "$tmp.output.toc") ||
continue
418 newserial
=$
(expr "$found" : '[^ ]* \(.*\)')
419 if test "$current" != "$section"
423 --------------------------------------------------
430 show_topic
"$tmp.template.$oldserial" "$tmp.output.$newserial"
431 done <"$tmp.template.toc"