blob: f8a78fb64e44689b9e1cfb8dcf10d47256cea25b [file] [log] [blame]
Daniel Stenberg70d8ac62018-12-11 15:06:21 +01001#!/usr/bin/perl
2#***************************************************************************
3# _ _ ____ _
4# Project ___| | | | _ \| |
5# / __| | | | |_) | |
6# | (__| |_| | _ <| |___
7# \___|\___/|_| \_\_____|
8#
Daniel Stenberg062eaa62020-01-07 08:30:59 +01009# Copyright (C) 2018-2020, Daniel Stenberg, <daniel@haxx.se>, et al.
Daniel Stenberg70d8ac62018-12-11 15:06:21 +010010#
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 Stenberg4d2f8002020-11-04 14:02:01 +010013# are also available at https://curl.se/docs/copyright.html.
Daniel Stenberg70d8ac62018-12-11 15:06:21 +010014#
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 Gustafssona92e9f52019-03-31 22:39:29 +020024# Display changes done in the repository from [tag] until now.
Daniel Stenberg70d8ac62018-12-11 15:06:21 +010025#
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 Stenberg5296abe2020-02-05 07:48:18 +010033if($start eq "-h") {
Daniel Stenberg70d8ac62018-12-11 15:06:21 +010034 print "Usage: summary [tag]\n";
35 exit;
36}
Daniel Stenberg5296abe2020-02-05 07:48:18 +010037elsif($start eq "") {
Daniel Stenberg4608fa42020-08-27 14:25:24 +020038 $start = `git tag --sort=taggerdate | grep "^curl-" | tail -1`;
Daniel Stenberg5296abe2020-02-05 07:48:18 +010039 chomp $start;
40}
Daniel Stenberg70d8ac62018-12-11 15:06:21 +010041
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 Stenberg5296abe2020-02-05 07:48:18 +010052# number of contributors right now
53$acontribs = `./scripts/contrithanks.sh | grep -c '^[^ ]'`;
Daniel Stenberg70d8ac62018-12-11 15:06:21 +010054# 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 Stenberg062eaa62020-01-07 08:30:59 +010060$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 Stenberg70d8ac62018-12-11 15:06:21 +010062$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 Stenberg1568d712018-12-11 15:25:52 +010071$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 Stenberg70d8ac62018-12-11 15:06:21 +010073
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
77chomp $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 Stenbergb4d86d32020-09-03 08:18:32 +020086# diffstat
87$diffstat=`git diff --stat $start.. | tail -1`;
88
Daniel Gustafssona92e9f52019-03-31 22:39:29 +020089# Changes/bug-fixes currently logged
Daniel Stenberg70d8ac62018-12-11 15:06:21 +010090open(F, "<RELEASE-NOTES");
91while(<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}
116close(F);
117
118########################################################################
119# Produce the summary
120
Daniel Stenbergb4d86d32020-09-03 08:18:32 +0200121print "== Since $start $taggednice ==\n";
122printf "Elapsed time: %.1f days\n",
123 $elapsed / 3600 / 24;
124printf "Commits: %d (out of %d)\n",
Daniel Stenberg70d8ac62018-12-11 15:06:21 +0100125 $commits, $acommits;
Daniel Stenbergb4d86d32020-09-03 08:18:32 +0200126printf "Commit authors: %d, %d new (total %d)\n",
Daniel Stenberg70d8ac62018-12-11 15:06:21 +0100127 $committers, $ncommitters, $acommitters;
Daniel Stenbergb4d86d32020-09-03 08:18:32 +0200128printf "Contributors: %d, %d new (total %d)\n",
129 $numcontributors, $contribs, $acontribs;
130printf "New public functions: %d (total %d)\n",
131 $public, $apublic;
132printf "New curl_easy_setopt() options: %d (total %d)\n",
Daniel Stenberg70d8ac62018-12-11 15:06:21 +0100133 $nsetopts, $asetopts;
Daniel Stenbergb4d86d32020-09-03 08:18:32 +0200134printf "New command line options: %d (total %d)\n",
Daniel Stenberg70d8ac62018-12-11 15:06:21 +0100135 $noptions, $aoptions;
Daniel Stenbergb4d86d32020-09-03 08:18:32 +0200136printf "Changes logged: %d\n", $numchanges;
137printf "Bugfixes logged: %d\n", $numbugfixes;
Daniel Stenberg70d8ac62018-12-11 15:06:21 +0100138printf "Deleted %d files, added %d files (total %d)\n",
139 $deletes, $creates, $afiles;
Daniel Stenbergb4d86d32020-09-03 08:18:32 +0200140print "Diffstat:$diffstat";