2
0

delta 4.5 KB

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