scripts/delta: check the file delta for current branch

... also polish the output style a little bit
This commit is contained in:
Daniel Stenberg 2022-02-03 23:42:02 +01:00
parent 2cb0eaba75
commit 5ad5007eba
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -6,7 +6,7 @@
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2018-2021, Daniel Stenberg, <daniel@haxx.se>, et al.
# Copyright (C) 2018-2022, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
@ -66,10 +66,13 @@ $aoptions=`grep -c '{"....--' src/tool_listhelp.c`;
$boptions=`git show $start:src/tool_listhelp.c 2>/dev/null | grep -c '{"....--'`;
$noptions=$aoptions - $boptions;
# current local branch
$branch=`git rev-parse --abbrev-ref HEAD 2>/dev/null`;
chomp $branch;
# Number of files in git
$afiles=`git ls-files | wc -l`;
$deletes=`git diff-tree --diff-filter=A -r --summary origin/master $start | wc -l`;
$creates=`git diff-tree --diff-filter=D -r --summary origin/master $start | wc -l`;
$deletes=`git diff-tree --diff-filter=A -r --summary origin/$branch $start | wc -l`;
$creates=`git diff-tree --diff-filter=D -r --summary origin/$branch $start | wc -l`;
# Time since that tag
$tagged=`git for-each-ref --format="%(refname:short) | %(taggerdate:unix)" refs/tags/* | grep ^$start | cut "-d|" -f2`; # unix timestamp
@ -86,6 +89,9 @@ $public = $apublic - $bpublic;
# diffstat
$diffstat=`git diff --stat $start.. | tail -1`;
if($diffstat =~ /^ *(\d+) files changed, (\d+) insertions\(\+\), (\d+)/) {
($fileschanged, $insertions, $deletions)=($1, $2, $3);
}
# Changes/bug-fixes currently logged
open(F, "<RELEASE-NOTES");
@ -137,6 +143,12 @@ printf "New command line options: %d (total %d)\n",
$noptions, $aoptions;
printf "Changes logged: %d\n", $numchanges;
printf "Bugfixes logged: %d\n", $numbugfixes;
printf "Deleted %d files, added %d files (total %d)\n",
$deletes, $creates, $afiles;
print "Diffstat:$diffstat";
printf "Added files: %d (total %d)\n",
$creates, $afiles;
printf "Deleted files: %d (delta: %d)\n", $deletes,
$creates - $deletes;
print "Diffstat:$diffstat" if(!$fileschanged);
printf "Files changed: %d\n", $fileschanged;
printf "Lines inserted: %d\n", $insertions;
printf "Lines deleted: %d (delta: %d)\n", $deletions,
$insertions - $deletions;