master
1#!/usr/bin/env perl
2#***************************************************************************
3# _ _ ____ _
4# Project ___| | | | _ \| |
5# / __| | | | |_) | |
6# | (__| |_| | _ <| |___
7# \___|\___/|_| \_\_____|
8#
9# Copyright (C) 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# SPDX-License-Identifier: curl
23#
24###########################################################################
26# Display changes done in the repository from [tag] until now.
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]'
33use strict;
34use warnings;
36use POSIX;
37use IPC::Open3;
38use Time::Piece;
40sub cmd {
41 my @out;
42 my $as_string = shift if($_[0] eq '$'); # return as string (vs. list of lines)
43 my $hideerr = shift if($_[0] eq '2>'); # 2>/dev/null
44 my $pid = open3(my $in, my $out, $hideerr ? '>/dev/null' : '>&STDERR', @_);
45 close $in;
46 push @out, <$out>;
47 waitpid($pid, 0);
48 return $as_string ? join('', @out) : @out;
49}
51my $start = $ARGV[0] || '';
53if($start eq "-h") {
54 print "Usage: summary [tag]\n";
55 exit;
56}
57elsif($start eq "") {
58 my @tags = cmd('git', 'tag', '--sort=taggerdate', '--no-column', '--list', 'curl-*');
59 $start = $tags[-1]; # latest tag
60 chomp $start;
61}
63my $commits = cmd('$', 'git', 'rev-list', '--count', "$start..");
64my $committers = cmd('git', 'shortlog', '-s', "$start..");
65my $bcommitters = cmd('git', 'shortlog', '-s', $start);
67my $acommits = cmd('$', 'git', 'rev-list', '--count', 'HEAD');
68my $acommitters = cmd('git', 'shortlog', '-s', 'HEAD');
70# delta from now compared to before
71my $ncommitters = $acommitters - $bcommitters;
73# number of contributors right now
74my $acontribs = cmd('./scripts/contrithanks.sh', 'stdout');
75# number when the tag was set
76my $bcontribs = cmd('$', 'git', 'grep', '-h', '-c', '^[^ ]', "$start:docs/THANKS");
77# delta
78my $contribs = $acontribs - $bcontribs;
80# number of setops:
81sub setopts {
82 my $mode = shift;
83 my $opts = 0;
84 if(open(H, $mode, @_)) {
85 while(<H>) {
86 if(/^ CURLOPT(|DEPRECATED)\(/ && ($_ !~ /OBSOLETE/)) {
87 $opts++;
88 }
89 }
90 close(H);
91 }
92 else {
93 die join(' ', @_) . ": $!\n";
94 }
95 return $opts;
96}
97my $asetopts = setopts('<', 'include/curl/curl.h');
98my $bsetopts = setopts('-|', 'git', 'show', "$start:include/curl/curl.h");
99my $nsetopts = $asetopts - $bsetopts;
101# Number of command line options:
102my $aoptions = cmd('$', '2>', 'git', 'grep', '-h', '-c', '{ *"....--', 'src/tool_listhelp.c');
103my $boptions = cmd('$', '2>', 'git', 'grep', '-h', '-c', '{ *"....--', "$start:src/tool_listhelp.c");
104my $noptions = $aoptions - $boptions;
106# current local branch
107my $branch = cmd('$', '2>', 'git', 'rev-parse', '--abbrev-ref', 'HEAD');
108chomp $branch;
109# Number of files in git
110my $afiles = cmd('git', 'ls-files');
111my $deletes = cmd('2>', 'git', 'diff-tree', '--diff-filter=A', '-r', '--summary', "origin/$branch", $start);
112my $creates = cmd('2>', 'git', 'diff-tree', '--diff-filter=D', '-r', '--summary', "origin/$branch", $start);
114# Time since that tag
115sub tagstamp {
116 my $col = shift;
117 foreach my $line (@_) {
118 if(index($line, "$start ") == 0) {
119 my @cols = split(/\|/, $line);
120 return $cols[$col - 1];
121 }
122 }
123}
124my @tagged = cmd('git', 'for-each-ref', '--format=%(refname:short) | %(taggerdate:unix) | %(creatordate)', 'refs/tags/*');
125my $tagged = tagstamp(2, @tagged); # Unix timestamp
126my $taggednice = tagstamp(3, @tagged); # human readable time
127chomp $taggednice;
128my $now = POSIX::strftime("%s", localtime());
129my $elapsed = $now - $tagged; # number of seconds since tag
130my $total = $now - Time::Piece->strptime('19980320', '%Y%m%d')->epoch;
131my $totalhttpget = $now - Time::Piece->strptime('19961111', '%Y%m%d')->epoch;
133# Number of public functions in libcurl
134my $apublic = cmd('git', 'grep', '--end-of-options', '^CURL_EXTERN', '--', 'include/curl');
135my $bpublic = cmd('git', 'grep', '--end-of-options', '^CURL_EXTERN', $start, '--', 'include/curl');
136my $public = $apublic - $bpublic;
138# diffstat
139my ($fileschanged, $insertions, $deletions);
140my @diffstat = cmd('2>', 'git', 'diff', '--stat', "$start..");
141my $diffstat = $diffstat[-1];
142if($diffstat =~ /^ *(\d+) files changed, (\d+) insertions\(\+\), (\d+)/) {
143 ($fileschanged, $insertions, $deletions) = ($1, $2, $3);
144}
146# Changes/bug-fixes currently logged
147my $numchanges = 0;
148my $numbugfixes = 0;
149my $numcontributors = 0;
150open(F, "<RELEASE-NOTES");
151my $mode = 0;
152while(<F>) {
153 if($_ =~ /following changes:/) {
154 $mode = 1;
155 }
156 elsif($_ =~ /following bugfixes:/) {
157 $mode = 2;
158 }
159 elsif($_ =~ /known bugs:/) {
160 $mode = 3;
161 }
162 elsif($_ =~ /like these:/) {
163 $mode = 4;
164 }
165 if($_ =~ /^ o /) {
166 if($mode == 1) {
167 $numchanges++;
168 }
169 elsif($mode == 2) {
170 $numbugfixes++;
171 }
172 }
173 if(($mode == 4) && ($_ =~ /^ \((\d+) contributors/)) {
174 $numcontributors = $1;
175 }
176}
177close(F);
179########################################################################
180# Produce the summary
182print "== Since $start $taggednice ==\n";
183my $days = $elapsed / 3600 / 24;
184printf "Elapsed time: %.1f days (total %d / %d)\n",
185 $days, $total / 3600 / 24, $totalhttpget / 3600 / 24;
186printf "Commits: %d (total %d)\n",
187 $commits, $acommits;
188printf "Commit authors: %d, %d new (total %d)\n",
189 $committers, $ncommitters, $acommitters;
190printf "Contributors: %d, %d new (total %d)\n",
191 $numcontributors, $contribs, $acontribs;
192printf "New public functions: %d (total %d)\n",
193 $public, $apublic;
194printf "New curl_easy_setopt() options: %d (total %d)\n",
195 $nsetopts, $asetopts;
196printf "New command line options: %d (total %d)\n",
197 $noptions, $aoptions;
198printf "Changes logged: %d\n", $numchanges;
199printf "Bugfixes logged: %d (%.2f per day)\n",
200 $numbugfixes, $days ? $numbugfixes / $days : $numbugfixes;
201printf "Added files: %d (total %d)\n",
202 $creates, $afiles;
203printf "Deleted files: %d (delta: %d)\n", $deletes,
204 $creates - $deletes;
205print "Diffstat:$diffstat" if(!$fileschanged);
206printf "Files changed: %d (%.2f%%)\n", $fileschanged, $fileschanged * 100 / $afiles;
207printf "Lines inserted: %d\n", $insertions;
208printf "Lines deleted: %d (delta: %d)\n", $deletions,
209 $insertions - $deletions;
Diagnostics4 git calls · 27 ms
CallStatusSizeTime027 ms
discover200152 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200149 B · hit4 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=4 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=4 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=149 git.pkt.payload.max=78 git.ls_refs.count=2 git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=10 git.pkt.data=8 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=293470 git.pkt.payload.max=65516 git.sideband.band1.bytes=293354 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=87 git.pack.bytes=293354 git.pack.ofs_delta=0 git.pack.ref_delta=1 git.pack.chain.max=1 git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0 git.pack.full=86Open pack map
fetch2002.8 KiB · hit20 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=20 git.response.bytes=2832 git.response.cache=HIT git.response.duration_ms=20 git.fetch.wants=d5b174044f51279268a078343e39ae907d609fb2 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=2832 git.pkt.payload.max=2811 git.sideband.band1.bytes=2810 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
- Ref
- refs/heads/master
- Commit
- 31c911efe5652725e930f4d2e60c9060e5f6646d
- cf-ray
- a5e20d480bac7f3b
- Request
- 64b56fca…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format