]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
scripts/delta: check the file delta for current branch
authorDaniel Stenberg <daniel@haxx.se>
Thu, 3 Feb 2022 22:42:02 +0000 (23:42 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 3 Feb 2022 22:42:43 +0000 (23:42 +0100)
... also polish the output style a little bit

scripts/delta

index bc1681fadd35ed38568aac712c3a08a837d92025..cb246e445aa438181d348f86b1b8b150c67f436a 100755 (executable)
@@ -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;