1#!/bin/sh
2#***************************************************************************
3#                                  _   _ ____  _
4#  Project                     ___| | | |  _ \| |
5#                             / __| | | | |_) | |
6#                            | (__| |_| |  _ <| |___
7#                             \___|\___/|_| \_\_____|
8#
9# Copyright (C) 2013-2016, Daniel Stenberg, <daniel@haxx.se>, et al.
10#
11# This software is licensed as described in the file COPYING, which
12# you should have received as part of this distribution. The terms
13# are also available at https://curl.haxx.se/docs/copyright.html.
14#
15# You may opt to use, copy, modify, merge, publish, distribute and/or sell
16# copies of the Software, and permit persons to whom the Software is
17# furnished to do so, under the terms of the COPYING file.
18#
19# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20# KIND, either express or implied.
21#
22###########################################################################
23
24#
25# This script shows all mentioned contributors from the given <hash>/<tag>
26# until HEAD and adds the contributors already mentioned in the existing
27# RELEASE-NOTES.
28#
29
30start=$1
31
32if test -z "$start"; then
33    echo "Usage: $0 <since this tag/hash> [--releasenotes]"
34    exit
35fi
36
37# filter out Author:, Commit: and *by: lines
38# cut off the email parts
39# split list of names at comma
40# split list of names at " and "
41# cut off spaces first and last on the line
42# filter alternatives through THANKS-filter
43# only count names with a space (ie more than one word)
44# sort all unique names
45# awk them into RELEASE-NOTES format
46(
47git log $start..HEAD | \
48egrep -ai '(^Author|^Commit|by):' | \
49cut -d: -f2- | \
50cut '-d<' -f1 | \
51tr , '\012' | \
52sed 's/ and /\n/' | \
53sed -e 's/^ //' -e 's/ $//g' -e 's/@users.noreply.github.com$/ on github/'
54
55grep -a "^  [^ \(]" RELEASE-NOTES| \
56sed 's/, */\n/g'| \
57sed 's/^ *//'
58
59)| \
60sed -f ./docs/THANKS-filter | \
61grep -a ' ' | \
62sort -fu | \
63awk '{
64 num++;
65 n = sprintf("%s%s%s,", n, length(n)?" ":"", $0);
66 #print n;
67 if(length(n) > 77) {
68   printf("  %s\n", p);
69   n=sprintf("%s,", $0);
70 }
71 p=n;
72
73}
74
75 END {
76   printf("  %s\n", p);
77   printf("  (%d contributors)\n", num);
78 }
79
80'
81