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