Home | History | Annotate | Download | only in scripts
      1 #!/bin/sh
      2 #***************************************************************************
      3 #                                  _   _ ____  _
      4 #  Project                     ___| | | |  _ \| |
      5 #                             / __| | | | |_) | |
      6 #                            | (__| |_| |  _ <| |___
      7 #                             \___|\___/|_| \_\_____|
      8 #
      9 # Copyright (C) 2013-2015, Daniel Stenberg, <daniel (at] 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 http://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 <hash> until HEAD. To aid
     26 # when writing RELEASE-NOTES and THANKS.
     27 #
     28 # Use --releasenotes to also include the names from the existing RELEASE-NOTES
     29 # file, which is handy when we've added names manually in there that should be
     30 # included in an updated list.
     31 #
     32 
     33 start=$1
     34 
     35 if test -z "$start"; then
     36     echo "Usage: $0 <since this tag/hash> [--releasenotes]"
     37     exit
     38 fi
     39 
     40 # filter out Author:, Commit: and *by: lines
     41 # cut off the email parts
     42 # split list of names at comma
     43 # split list of names at " and "
     44 # cut off spaces first and last on the line
     45 # filter alternatives through THANKS-filter
     46 # only count names with a space (ie more than one word)
     47 # sort all unique names
     48 # awk them into RELEASE-NOTES format
     49 (
     50 git log $start..HEAD | \
     51 egrep -i '(Author|Commit|by):' | \
     52 cut -d: -f2- | \
     53 cut '-d<' -f1 | \
     54 tr , '\012' | \
     55 sed 's/ and /\n/' | \
     56 sed -e 's/^ //' -e 's/ $//g'
     57 
     58 if echo "$*" | grep -qw -- '--releasenotes';then
     59     # if --releasenotes was used
     60     # grep out the list of names from RELEASE-NOTES
     61     # split on ", "
     62     # remove leading white spaces
     63 grep "^  [^ \(]" RELEASE-NOTES| \
     64 sed 's/, */\n/g'| \
     65 sed 's/^ *//'
     66 fi
     67 )| \
     68 sed -f ./docs/THANKS-filter | \
     69 grep ' ' | \
     70 sort -fu | \
     71 awk '{
     72  num++;
     73  n = sprintf("%s%s%s,", n, length(n)?" ":"", $0);
     74  #print n;
     75  if(length(n) > 78) {
     76    printf("  %s\n", p);
     77    n=sprintf("%s,", $0);
     78  }
     79  p=n;
     80 
     81 }
     82 
     83  END {
     84    printf("  %s\n", p);
     85    printf("  (%d contributors)\n", num);
     86  }
     87 
     88 '
     89