What's cooking (2021/06 #06)
[git] / Announce
1 #!/bin/sh
2 # Announcement message skelton
3 #
4 MASTER=master
5
6 tmpbase=/var/tmp/git-announce.$$
7 trap 'rm -f $tmpbase.*' 0
8 branch=${1?branch}
9 previous=${2?previous}
10 commit=${3-"$1"}
11
12 relname=$(git describe "$commit") &&
13 vername=$(expr "$relname" : 'v\(.*\)') || exit $?
14
15 git rev-parse --verify "$previous" >/dev/null || exit $?
16
17 case "$branch" in
18 maint)
19         kind="The latest maintenance release" ;;
20 mainto/* | maint-[0-9]*)
21         kind="A maintenance release" ;;
22 $MASTER)
23         kind="The latest feature release" ;;
24 esac
25
26 case "$vername" in
27 *-rc[0-9]*)
28         rpmroot=testing
29         case "$vername" in
30         *-rc0)
31                 kind="An early preview release"
32                 ;;
33         *)
34                 kind="A release candidate"
35                 ;;
36         esac
37         for_testing=" for testing"
38         ;;
39 *)
40         for_testing=
41         rpmroot='RPMS/$arch'
42         ;;
43 esac
44
45 vername=$(echo "$vername" | tr "-" ".")
46
47 people () {
48         git shortlog -s --no-merges \
49                 --group=author \
50                 --group=trailer:co-authored-by \
51                 --group=trailer:reviewed-by \
52                 --group=trailer:mentored-by \
53                 --group=trailer:helped-by \
54                 --group=trailer:tested-by \
55                 --group=trailer:reported-by \
56                 "$@" |
57         sed -e 's/^[    0-9]*[  ]//' -e 's/$/,/' |
58         sort -u
59 }
60
61 people "$previous" >"$tmpbase.prev"
62 people "$previous..$commit" >"$tmpbase.this"
63
64 comm -12 "$tmpbase.prev" "$tmpbase.this" >"$tmpbase.old"
65 comm -13 "$tmpbase.prev" "$tmpbase.this" >"$tmpbase.new"
66
67 all=$(wc -l <"$tmpbase.this")
68 new=$(wc -l <"$tmpbase.new")
69 cnt=$(git rev-list --no-merges "$previous..$commit" | wc -l)
70
71 cat <<EOF
72 To: git@vger.kernel.org
73 Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
74     git-packagers@googlegroups.com
75 Bcc: lwn@lwn.net
76 Subject: [ANNOUNCE] Git $relname
77
78 EOF
79
80 (
81         echo "$kind Git $relname is now available$for_testing at the usual places."
82         if test "$branch" = $MASTER
83         then
84                 cat <<-EOF
85                 It is comprised of $cnt non-merge commits since $previous,
86                 contributed by $all people, $new of which are new faces [*].
87                 EOF
88         fi
89 ) | fmt -68
90
91 cat <<EOF
92
93 The tarballs are found at:
94
95     https://www.kernel.org/pub/software/scm/git/${for_testing:+testing/}
96
97 EOF
98
99 (
100         cat <<-EOF
101         The following public repositories all have a copy of
102         the '$relname' tag and
103         EOF
104         case "$branch" in
105         maint-* | mainto/*)
106                 echo "some of them have"
107                 ;;
108         esac
109         echo "the '$branch' branch that the tag points at:"
110 ) | fmt -68
111
112 cat <<\EOF
113
114   url = https://git.kernel.org/pub/scm/git/git
115   url = https://kernel.googlesource.com/pub/scm/git/git
116   url = git://repo.or.cz/alt-git.git
117   url = https://github.com/gitster/git
118 EOF
119
120 fmt_people () {
121         # Yes, I don't perform well without 2 or more people.
122         # Sue me. The heading says "are as follows" anyway ;-).
123         sed -e '${
124                 s/^/and /
125                 s/,$/./
126         }' "$1" |
127         fmt -66 |
128         sed -e 's/^/  /'
129
130 }
131
132 if test "$branch" = $MASTER
133 then
134         cat <<-EOF
135
136         New contributors whose contributions weren't in $previous are as follows.
137         Welcome to the Git development community!
138
139         $(fmt_people "$tmpbase.new")
140
141         Returning contributors who helped this release are as follows.
142         Thanks for your continued support.
143
144         $(fmt_people "$tmpbase.old")
145
146         [*] We are counting not just the authorship contribution but issue
147             reporting, mentoring, helping and reviewing that are recorded in
148             the commit trailers.
149         EOF
150 fi
151
152 cat <<EOF
153
154 ----------------------------------------------------------------
155
156 EOF
157
158 case "$(git ls-tree ${branch} RelNotes)" in
159 120000' '*)
160         RelNotes=$(git cat-file blob "${branch}:RelNotes")
161         ;;
162 *)
163         RelNotes=RelNotes
164         ;;
165 esac &&
166 git cat-file blob "${branch}:$RelNotes" |
167 case "$relname" in
168 *-*)
169         sed -e 's/^Git .* Release Notes$/& (draft)/' \
170             -e 's/^=============/&========/'
171         ;;
172 *)
173         cat
174         ;;
175 esac
176
177 cat <<EOF
178
179 ----------------------------------------------------------------
180
181 Changes since $previous are as follows:
182
183 EOF
184
185 git log --no-merges "$previous".."$branch" |
186 git shortlog