delta 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. #!/usr/bin/perl
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) 2018-2021, 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. $total=$now - `date -d 19980320 +%s`;
  70. # Number of public functions in libcurl
  71. $apublic=`git grep ^CURL_EXTERN -- include/curl | wc -l`;
  72. $bpublic=`git grep ^CURL_EXTERN $start -- include/curl | wc -l`;
  73. $public = $apublic - $bpublic;
  74. # diffstat
  75. $diffstat=`git diff --stat $start.. | tail -1`;
  76. # Changes/bug-fixes currently logged
  77. open(F, "<RELEASE-NOTES");
  78. while(<F>) {
  79. if($_ =~ /following changes:/) {
  80. $mode=1;
  81. }
  82. elsif($_ =~ /following bugfixes:/) {
  83. $mode=2;
  84. }
  85. elsif($_ =~ /known bugs:/) {
  86. $mode=3;
  87. }
  88. elsif($_ =~ /like these:/) {
  89. $mode=4;
  90. }
  91. if($_ =~ /^ o /) {
  92. if($mode == 1) {
  93. $numchanges++;
  94. }
  95. elsif($mode == 2) {
  96. $numbugfixes++;
  97. }
  98. }
  99. if(($mode == 4) && ($_ =~ /^ \((\d+) contributors/)) {
  100. $numcontributors = $1;
  101. }
  102. }
  103. close(F);
  104. ########################################################################
  105. # Produce the summary
  106. print "== Since $start $taggednice ==\n";
  107. printf "Elapsed time: %.1f days (total %d)\n",
  108. $elapsed / 3600 / 24,
  109. $total / 3600 / 24;
  110. printf "Commits: %d (total %d)\n",
  111. $commits, $acommits;
  112. printf "Commit authors: %d, %d new (total %d)\n",
  113. $committers, $ncommitters, $acommitters;
  114. printf "Contributors: %d, %d new (total %d)\n",
  115. $numcontributors, $contribs, $acontribs;
  116. printf "New public functions: %d (total %d)\n",
  117. $public, $apublic;
  118. printf "New curl_easy_setopt() options: %d (total %d)\n",
  119. $nsetopts, $asetopts;
  120. printf "New command line options: %d (total %d)\n",
  121. $noptions, $aoptions;
  122. printf "Changes logged: %d\n", $numchanges;
  123. printf "Bugfixes logged: %d\n", $numbugfixes;
  124. printf "Deleted %d files, added %d files (total %d)\n",
  125. $deletes, $creates, $afiles;
  126. print "Diffstat:$diffstat";