| a1346054 | 5458e6b | 2021-08-21 10:57:11 +0000 | [diff] [blame] | 1 | #!/usr/bin/env perl |
| Daniel Stenberg | 70d8ac6 | 2018-12-11 15:06:21 +0100 | [diff] [blame] | 2 | #*************************************************************************** |
| 3 | # _ _ ____ _ |
| 4 | # Project ___| | | | _ \| | |
| 5 | # / __| | | | |_) | | |
| 6 | # | (__| |_| | _ <| |___ |
| 7 | # \___|\___/|_| \_\_____| |
| 8 | # |
| Daniel Stenberg | 2bc1d77 | 2023-01-02 13:51:48 +0100 | [diff] [blame^] | 9 | # Copyright (C) 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 | # |
| max.mehl | ad9bc59 | 2022-05-17 11:16:50 +0200 | [diff] [blame] | 22 | # SPDX-License-Identifier: curl |
| 23 | # |
| Daniel Stenberg | 70d8ac6 | 2018-12-11 15:06:21 +0100 | [diff] [blame] | 24 | ########################################################################### |
| 25 | |
| Daniel Gustafsson | a92e9f5 | 2019-03-31 22:39:29 +0200 | [diff] [blame] | 26 | # Display changes done in the repository from [tag] until now. |
| Daniel Stenberg | 70d8ac6 | 2018-12-11 15:06:21 +0100 | [diff] [blame] | 27 | # |
| 28 | # Uses git for repo data. |
| 29 | # Uses docs/THANKS and RELEASE-NOTES for current status. |
| 30 | # |
| 31 | # In the git clone root, invoke 'scripts/delta [release tag]' |
| 32 | |
| 33 | $start = $ARGV[0]; |
| 34 | |
| Daniel Stenberg | 5296abe | 2020-02-05 07:48:18 +0100 | [diff] [blame] | 35 | if($start eq "-h") { |
| Daniel Stenberg | 70d8ac6 | 2018-12-11 15:06:21 +0100 | [diff] [blame] | 36 | print "Usage: summary [tag]\n"; |
| 37 | exit; |
| 38 | } |
| Daniel Stenberg | 5296abe | 2020-02-05 07:48:18 +0100 | [diff] [blame] | 39 | elsif($start eq "") { |
| Daniel Stenberg | 4608fa4 | 2020-08-27 14:25:24 +0200 | [diff] [blame] | 40 | $start = `git tag --sort=taggerdate | grep "^curl-" | tail -1`; |
| Daniel Stenberg | 5296abe | 2020-02-05 07:48:18 +0100 | [diff] [blame] | 41 | chomp $start; |
| 42 | } |
| Daniel Stenberg | 70d8ac6 | 2018-12-11 15:06:21 +0100 | [diff] [blame] | 43 | |
| 44 | $commits = `git log --oneline $start.. | wc -l`; |
| 45 | $committers = `git shortlog -s $start.. | wc -l`; |
| 46 | $bcommitters = `git shortlog -s $start | wc -l`; |
| 47 | |
| 48 | $acommits = `git log --oneline | wc -l`; |
| 49 | $acommitters = `git shortlog -s | wc -l`; |
| 50 | |
| 51 | # delta from now compared to before |
| 52 | $ncommitters = $acommitters - $bcommitters; |
| 53 | |
| Daniel Stenberg | 5296abe | 2020-02-05 07:48:18 +0100 | [diff] [blame] | 54 | # number of contributors right now |
| 55 | $acontribs = `./scripts/contrithanks.sh | grep -c '^[^ ]'`; |
| Daniel Stenberg | 70d8ac6 | 2018-12-11 15:06:21 +0100 | [diff] [blame] | 56 | # number when the tag tag was set |
| 57 | $bcontribs = `git show $start:docs/THANKS | grep -c '^[^ ]'`; |
| 58 | # delta |
| 59 | $contribs = $acontribs - $bcontribs; |
| 60 | |
| 61 | # number of setops: |
| Daniel Stenberg | 709aefc | 2022-11-17 14:41:04 +0100 | [diff] [blame] | 62 | sub setopts { |
| 63 | my ($f)=@_; |
| 64 | open(H, "$f"); |
| 65 | my $opts; |
| 66 | while(<H>) { |
| 67 | if(/^ CURLOPT(|DEPRECATED)\(/ && ($_ !~ /OBSOLETE/)) { |
| 68 | $opts++; |
| 69 | } |
| 70 | } |
| 71 | close(H); |
| 72 | return $opts; |
| 73 | } |
| 74 | $asetopts = setopts("<include/curl/curl.h"); |
| 75 | $bsetopts = setopts("git show $start:include/curl/curl.h|"); |
| Daniel Stenberg | 70d8ac6 | 2018-12-11 15:06:21 +0100 | [diff] [blame] | 76 | $nsetopts = $asetopts - $bsetopts; |
| 77 | |
| 78 | # Number of command line options: |
| Daniel Stenberg | 8bb5f4d | 2021-10-01 08:49:12 +0200 | [diff] [blame] | 79 | $aoptions=`grep -c '{"....--' src/tool_listhelp.c`; |
| Daniel Stenberg | 343644f | 2021-10-02 23:36:00 +0200 | [diff] [blame] | 80 | $boptions=`git show $start:src/tool_listhelp.c 2>/dev/null | grep -c '{"....--'`; |
| Daniel Stenberg | 70d8ac6 | 2018-12-11 15:06:21 +0100 | [diff] [blame] | 81 | $noptions=$aoptions - $boptions; |
| 82 | |
| Daniel Stenberg | 5ad5007 | 2022-02-03 23:42:02 +0100 | [diff] [blame] | 83 | # current local branch |
| 84 | $branch=`git rev-parse --abbrev-ref HEAD 2>/dev/null`; |
| 85 | chomp $branch; |
| Daniel Stenberg | 70d8ac6 | 2018-12-11 15:06:21 +0100 | [diff] [blame] | 86 | # Number of files in git |
| 87 | $afiles=`git ls-files | wc -l`; |
| Daniel Stenberg | 5ad5007 | 2022-02-03 23:42:02 +0100 | [diff] [blame] | 88 | $deletes=`git diff-tree --diff-filter=A -r --summary origin/$branch $start | wc -l`; |
| 89 | $creates=`git diff-tree --diff-filter=D -r --summary origin/$branch $start | wc -l`; |
| Daniel Stenberg | 70d8ac6 | 2018-12-11 15:06:21 +0100 | [diff] [blame] | 90 | |
| 91 | # Time since that tag |
| 92 | $tagged=`git for-each-ref --format="%(refname:short) | %(taggerdate:unix)" refs/tags/* | grep ^$start | cut "-d|" -f2`; # unix timestamp |
| 93 | $taggednice=`git for-each-ref --format="%(refname:short) | %(creatordate)" refs/tags/* | grep ^$start | cut '-d|' -f2`; # human readable time |
| 94 | chomp $taggednice; |
| 95 | $now=`date +%s`; |
| 96 | $elapsed=$now - $tagged; # number of seconds since tag |
| Daniel Stenberg | f4dc08a | 2021-05-06 10:00:36 +0200 | [diff] [blame] | 97 | $total=$now - `date -d 19980320 +%s`; |
| Daniel Stenberg | 70d8ac6 | 2018-12-11 15:06:21 +0100 | [diff] [blame] | 98 | |
| 99 | # Number of public functions in libcurl |
| 100 | $apublic=`git grep ^CURL_EXTERN -- include/curl | wc -l`; |
| 101 | $bpublic=`git grep ^CURL_EXTERN $start -- include/curl | wc -l`; |
| 102 | $public = $apublic - $bpublic; |
| 103 | |
| Daniel Stenberg | b4d86d3 | 2020-09-03 08:18:32 +0200 | [diff] [blame] | 104 | # diffstat |
| 105 | $diffstat=`git diff --stat $start.. | tail -1`; |
| Daniel Stenberg | 5ad5007 | 2022-02-03 23:42:02 +0100 | [diff] [blame] | 106 | if($diffstat =~ /^ *(\d+) files changed, (\d+) insertions\(\+\), (\d+)/) { |
| 107 | ($fileschanged, $insertions, $deletions)=($1, $2, $3); |
| 108 | } |
| Daniel Stenberg | b4d86d3 | 2020-09-03 08:18:32 +0200 | [diff] [blame] | 109 | |
| Daniel Gustafsson | a92e9f5 | 2019-03-31 22:39:29 +0200 | [diff] [blame] | 110 | # Changes/bug-fixes currently logged |
| Daniel Stenberg | 70d8ac6 | 2018-12-11 15:06:21 +0100 | [diff] [blame] | 111 | open(F, "<RELEASE-NOTES"); |
| 112 | while(<F>) { |
| 113 | if($_ =~ /following changes:/) { |
| 114 | $mode=1; |
| 115 | } |
| 116 | elsif($_ =~ /following bugfixes:/) { |
| 117 | $mode=2; |
| 118 | } |
| 119 | elsif($_ =~ /known bugs:/) { |
| 120 | $mode=3; |
| 121 | } |
| 122 | elsif($_ =~ /like these:/) { |
| 123 | $mode=4; |
| 124 | } |
| 125 | if($_ =~ /^ o /) { |
| 126 | if($mode == 1) { |
| 127 | $numchanges++; |
| 128 | } |
| 129 | elsif($mode == 2) { |
| 130 | $numbugfixes++; |
| 131 | } |
| 132 | } |
| 133 | if(($mode == 4) && ($_ =~ /^ \((\d+) contributors/)) { |
| 134 | $numcontributors = $1; |
| 135 | } |
| 136 | } |
| 137 | close(F); |
| 138 | |
| 139 | ######################################################################## |
| 140 | # Produce the summary |
| 141 | |
| Daniel Stenberg | b4d86d3 | 2020-09-03 08:18:32 +0200 | [diff] [blame] | 142 | print "== Since $start $taggednice ==\n"; |
| Daniel Stenberg | f4dc08a | 2021-05-06 10:00:36 +0200 | [diff] [blame] | 143 | printf "Elapsed time: %.1f days (total %d)\n", |
| 144 | $elapsed / 3600 / 24, |
| 145 | $total / 3600 / 24; |
| 146 | printf "Commits: %d (total %d)\n", |
| Daniel Stenberg | 70d8ac6 | 2018-12-11 15:06:21 +0100 | [diff] [blame] | 147 | $commits, $acommits; |
| Daniel Stenberg | b4d86d3 | 2020-09-03 08:18:32 +0200 | [diff] [blame] | 148 | printf "Commit authors: %d, %d new (total %d)\n", |
| Daniel Stenberg | 70d8ac6 | 2018-12-11 15:06:21 +0100 | [diff] [blame] | 149 | $committers, $ncommitters, $acommitters; |
| Daniel Stenberg | b4d86d3 | 2020-09-03 08:18:32 +0200 | [diff] [blame] | 150 | printf "Contributors: %d, %d new (total %d)\n", |
| 151 | $numcontributors, $contribs, $acontribs; |
| 152 | printf "New public functions: %d (total %d)\n", |
| 153 | $public, $apublic; |
| 154 | printf "New curl_easy_setopt() options: %d (total %d)\n", |
| Daniel Stenberg | 70d8ac6 | 2018-12-11 15:06:21 +0100 | [diff] [blame] | 155 | $nsetopts, $asetopts; |
| Daniel Stenberg | b4d86d3 | 2020-09-03 08:18:32 +0200 | [diff] [blame] | 156 | printf "New command line options: %d (total %d)\n", |
| Daniel Stenberg | 70d8ac6 | 2018-12-11 15:06:21 +0100 | [diff] [blame] | 157 | $noptions, $aoptions; |
| Daniel Stenberg | b4d86d3 | 2020-09-03 08:18:32 +0200 | [diff] [blame] | 158 | printf "Changes logged: %d\n", $numchanges; |
| 159 | printf "Bugfixes logged: %d\n", $numbugfixes; |
| Daniel Stenberg | 5ad5007 | 2022-02-03 23:42:02 +0100 | [diff] [blame] | 160 | printf "Added files: %d (total %d)\n", |
| 161 | $creates, $afiles; |
| 162 | printf "Deleted files: %d (delta: %d)\n", $deletes, |
| 163 | $creates - $deletes; |
| 164 | print "Diffstat:$diffstat" if(!$fileschanged); |
| 165 | printf "Files changed: %d\n", $fileschanged; |
| 166 | printf "Lines inserted: %d\n", $insertions; |
| 167 | printf "Lines deleted: %d (delta: %d)\n", $deletions, |
| 168 | $insertions - $deletions; |