delta 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #!/usr/bin/perl
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) 2018-2020, 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. ###########################################################################
  23. # Display changes done in the repository from [tag] until now.
  24. #
  25. # Uses git for repo data.
  26. # Uses docs/THANKS and RELEASE-NOTES for current status.
  27. #
  28. # In the git clone root, invoke 'scripts/delta [release tag]'
  29. $start = $ARGV[0];
  30. if($start eq "-h") {
  31. print "Usage: summary [tag]\n";
  32. exit;
  33. }
  34. elsif($start eq "") {
  35. $start = `git tag --sort=taggerdate | grep "^curl-" | tail -1`;
  36. chomp $start;
  37. }
  38. $commits = `git log --oneline $start.. | wc -l`;
  39. $committers = `git shortlog -s $start.. | wc -l`;
  40. $bcommitters = `git shortlog -s $start | wc -l`;
  41. $acommits = `git log --oneline | wc -l`;
  42. $acommitters = `git shortlog -s | wc -l`;
  43. # delta from now compared to before
  44. $ncommitters = $acommitters - $bcommitters;
  45. # number of contributors right now
  46. $acontribs = `./scripts/contrithanks.sh | grep -c '^[^ ]'`;
  47. # number when the tag tag was set
  48. $bcontribs = `git show $start:docs/THANKS | grep -c '^[^ ]'`;
  49. # delta
  50. $contribs = $acontribs - $bcontribs;
  51. # number of setops:
  52. $asetopts=`grep '^ CURLOPT(' include/curl/curl.h | grep -cv OBSOLETE`;
  53. $bsetopts=`git show $start:include/curl/curl.h | grep '^ CURLOPT(' | grep -cv OBSOLETE`;
  54. $nsetopts = $asetopts - $bsetopts;
  55. # Number of command line options:
  56. $aoptions=`grep -c '{"....--' src/tool_help.c`;
  57. $boptions=`git show $start:src/tool_help.c | grep -c '{"....--'`;
  58. $noptions=$aoptions - $boptions;
  59. # Number of files in git
  60. $afiles=`git ls-files | wc -l`;
  61. $deletes=`git diff-tree --diff-filter=A -r --summary origin/master $start | wc -l`;
  62. $creates=`git diff-tree --diff-filter=D -r --summary origin/master $start | wc -l`;
  63. # Time since that tag
  64. $tagged=`git for-each-ref --format="%(refname:short) | %(taggerdate:unix)" refs/tags/* | grep ^$start | cut "-d|" -f2`; # unix timestamp
  65. $taggednice=`git for-each-ref --format="%(refname:short) | %(creatordate)" refs/tags/* | grep ^$start | cut '-d|' -f2`; # human readable time
  66. chomp $taggednice;
  67. $now=`date +%s`;
  68. $elapsed=$now - $tagged; # number of seconds since tag
  69. # Number of public functions in libcurl
  70. $apublic=`git grep ^CURL_EXTERN -- include/curl | wc -l`;
  71. $bpublic=`git grep ^CURL_EXTERN $start -- include/curl | wc -l`;
  72. $public = $apublic - $bpublic;
  73. # diffstat
  74. $diffstat=`git diff --stat $start.. | tail -1`;
  75. # Changes/bug-fixes currently logged
  76. open(F, "<RELEASE-NOTES");
  77. while(<F>) {
  78. if($_ =~ /following changes:/) {
  79. $mode=1;
  80. }
  81. elsif($_ =~ /following bugfixes:/) {
  82. $mode=2;
  83. }
  84. elsif($_ =~ /known bugs:/) {
  85. $mode=3;
  86. }
  87. elsif($_ =~ /like these:/) {
  88. $mode=4;
  89. }
  90. if($_ =~ /^ o /) {
  91. if($mode == 1) {
  92. $numchanges++;
  93. }
  94. elsif($mode == 2) {
  95. $numbugfixes++;
  96. }
  97. }
  98. if(($mode == 4) && ($_ =~ /^ \((\d+) contributors/)) {
  99. $numcontributors = $1;
  100. }
  101. }
  102. close(F);
  103. ########################################################################
  104. # Produce the summary
  105. print "== Since $start $taggednice ==\n";
  106. printf "Elapsed time: %.1f days\n",
  107. $elapsed / 3600 / 24;
  108. printf "Commits: %d (out of %d)\n",
  109. $commits, $acommits;
  110. printf "Commit authors: %d, %d new (total %d)\n",
  111. $committers, $ncommitters, $acommitters;
  112. printf "Contributors: %d, %d new (total %d)\n",
  113. $numcontributors, $contribs, $acontribs;
  114. printf "New public functions: %d (total %d)\n",
  115. $public, $apublic;
  116. printf "New curl_easy_setopt() options: %d (total %d)\n",
  117. $nsetopts, $asetopts;
  118. printf "New command line options: %d (total %d)\n",
  119. $noptions, $aoptions;
  120. printf "Changes logged: %d\n", $numchanges;
  121. printf "Bugfixes logged: %d\n", $numbugfixes;
  122. printf "Deleted %d files, added %d files (total %d)\n",
  123. $deletes, $creates, $afiles;
  124. print "Diffstat:$diffstat";