• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
24# Display changes done in the repository from [tag] until now.
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
33if($start eq "-h") {
34    print "Usage: summary [tag]\n";
35    exit;
36}
37elsif($start eq "") {
38    $start = `git tag --sort=taggerdate | grep "^curl-" | tail -1`;
39    chomp $start;
40}
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
52# number of contributors right now
53$acontribs = `./scripts/contrithanks.sh | grep -c '^[^ ]'`;
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:
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`;
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`;
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`;
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
77chomp $taggednice;
78$now=`date +%s`;
79$elapsed=$now - $tagged; # number of seconds since tag
80$total=$now - `date -d 19980320 +%s`;
81
82# Number of public functions in libcurl
83$apublic=`git grep ^CURL_EXTERN -- include/curl | wc -l`;
84$bpublic=`git grep ^CURL_EXTERN $start -- include/curl | wc -l`;
85$public = $apublic - $bpublic;
86
87# diffstat
88$diffstat=`git diff --stat $start.. | tail -1`;
89
90# Changes/bug-fixes currently logged
91open(F, "<RELEASE-NOTES");
92while(<F>) {
93    if($_ =~ /following changes:/) {
94        $mode=1;
95    }
96    elsif($_ =~ /following bugfixes:/) {
97        $mode=2;
98    }
99    elsif($_ =~ /known bugs:/) {
100        $mode=3;
101    }
102    elsif($_ =~ /like these:/) {
103        $mode=4;
104    }
105    if($_ =~ /^ o /) {
106        if($mode == 1) {
107            $numchanges++;
108        }
109        elsif($mode == 2) {
110            $numbugfixes++;
111        }
112    }
113    if(($mode == 4) && ($_ =~ /^  \((\d+) contributors/)) {
114        $numcontributors = $1;
115    }
116}
117close(F);
118
119########################################################################
120# Produce the summary
121
122print "== Since $start $taggednice ==\n";
123printf "Elapsed time:                   %.1f days (total %d)\n",
124    $elapsed / 3600 / 24,
125    $total / 3600 / 24;
126printf "Commits:                        %d (total %d)\n",
127    $commits, $acommits;
128printf "Commit authors:                 %d, %d new (total %d)\n",
129    $committers, $ncommitters, $acommitters;
130printf "Contributors:                   %d, %d new (total %d)\n",
131    $numcontributors, $contribs, $acontribs;
132printf "New public functions:           %d (total %d)\n",
133    $public, $apublic;
134printf "New curl_easy_setopt() options: %d (total %d)\n",
135    $nsetopts, $asetopts;
136printf "New command line options:       %d (total %d)\n",
137    $noptions, $aoptions;
138printf "Changes logged:                 %d\n", $numchanges;
139printf "Bugfixes logged:                %d\n", $numbugfixes;
140printf "Deleted %d files, added %d files (total %d)\n",
141    $deletes, $creates, $afiles;
142print "Diffstat:$diffstat";
143