Debian Codegraph @

deps/curl/scripts/delta

raw
1 #!/usr/bin/perl
2 #***************************************************************************
3 # _ _ ____ _
4 # Project ___| | | | _ \| |
5 # / __| | | | |_) | |
6 # | (__| |_| | _ <| |___
7 # \___|\___/|_| \_\_____|
8 #
9 # Copyright (C) 2018-2020, Daniel Stenberg, <[email protected]>, 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
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
33 if($start eq "-h") {
34 print "Usage: summary [tag]\n";
35 exit;
36 }
37 elsif($start eq "") {
38 $start = `git tag --sort=taggerdate | 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
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
86 # Changes/bug-fixes currently logged
87 open(F, "<RELEASE-NOTES");
88 while(<F>) {
89 if($_ =~ /following changes:/) {
90 $mode=1;
91 }
92 elsif($_ =~ /following bugfixes:/) {
93 $mode=2;
94 }
95 elsif($_ =~ /known bugs:/) {
96 $mode=3;
97 }
98 elsif($_ =~ /like these:/) {
99 $mode=4;
100 }
101 if($_ =~ /^ o /) {
102 if($mode == 1) {
103 $numchanges++;
104 }
105 elsif($mode == 2) {
106 $numbugfixes++;
107 }
108 }
109 if(($mode == 4) && ($_ =~ /^ \((\d+) contributors/)) {
110 $numcontributors = $1;
111 }
112 }
113 close(F);
114
115 ########################################################################
116 # Produce the summary
117
118 print "== Since $start ==\n";
119 printf "Commits: %d (out of %d)\n",
120 $commits, $acommits;
121 printf "Commit authors: %d out of which %d are new (out of %d)\n",
122 $committers, $ncommitters, $acommitters;
123 printf "Contributors in RELEASE-NOTES: %d\n",
124 $numcontributors;
125 printf "New contributors: %d (out of %d)\n",
126 $contribs, $acontribs;
127 printf "New curl_easy_setopt() options: %d (out of %d)\n",
128 $nsetopts, $asetopts;
129 printf "New command line options: %d (out of %d)\n",
130 $noptions, $aoptions;
131
132 printf "Deleted %d files, added %d files (total %d)\n",
133 $deletes, $creates, $afiles;
134
135 printf "Elapsed time: %.1f days (since$taggednice)\n",
136 $elapsed / 3600 / 24;
137 printf "Changes logged: %d\n", $numchanges;
138 printf "Bugfixes logged: %d\n", $numbugfixes;
139
140 printf "New public functions: %d (out of %d)\n",
141 $public, $apublic;