contributors.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #!/bin/sh
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) 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.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. # SPDX-License-Identifier: curl
  23. #
  24. ###########################################################################
  25. #
  26. # This script shows all mentioned contributors from the given <hash>/<tag>
  27. # until HEAD and adds the contributors already mentioned in the existing
  28. # RELEASE-NOTES.
  29. #
  30. start=$1
  31. if test "$start" = "-h"; then
  32. echo "Usage: $0 <since this tag/hash> [--releasenotes]"
  33. exit
  34. fi
  35. if test -z "$start"; then
  36. start=`git tag --sort=taggerdate | grep "^curl-" | tail -1`;
  37. echo "Since $start:"
  38. fi
  39. # We also include curl-www if possible. Override by setting CURLWWW
  40. if [ -z "$CURLWWW" ] ; then
  41. CURLWWW=../curl-www
  42. fi
  43. # filter out Author:, Commit: and *by: lines
  44. # cut off the email parts
  45. # split list of names at comma
  46. # split list of names at " and "
  47. # cut off spaces first and last on the line
  48. # filter alternatives through THANKS-filter
  49. # only count names with a space (ie more than one word)
  50. # sort all unique names
  51. # awk them into RELEASE-NOTES format
  52. (
  53. (
  54. git log --pretty=full --use-mailmap $start..HEAD
  55. if [ -d "$CURLWWW" ]
  56. then
  57. git -C "$CURLWWW" log --pretty=full --use-mailmap $start..HEAD
  58. fi
  59. ) | \
  60. grep -Eai '(^Author|^Commit|by):' | \
  61. cut -d: -f2- | \
  62. cut '-d(' -f1 | \
  63. cut '-d<' -f1 | \
  64. tr , '\012' | \
  65. sed 's/ at github/ on github/' | \
  66. sed 's/ and /\n/' | \
  67. sed -e 's/^ *//' -e 's/ $//g' -e 's/@users.noreply.github.com$/ on github/'
  68. grep -a "^ [^ \(]" RELEASE-NOTES| \
  69. sed 's/, */\n/g'| \
  70. sed 's/^ *//'
  71. )| \
  72. sed -f ./docs/THANKS-filter | \
  73. sort -fu | \
  74. awk '{
  75. if(length($0)) {
  76. num++;
  77. n = sprintf("%s%s%s,", n, length(n)?" ":"", $0);
  78. #print n;
  79. if(length(n) > 77) {
  80. printf(" %s\n", p);
  81. n=sprintf("%s,", $0);
  82. }
  83. p=n;
  84. }
  85. }
  86. END {
  87. pp=substr(p,1,length(p)-1);
  88. printf(" %s\n", pp);
  89. printf(" (%d contributors)\n", num);
  90. }
  91. '