]> git.ozlabs.org Git - next-scripts/commitdiff
Add totals to summaries
authorStephen Rothwell <sfr@canb.auug.org.au>
Tue, 19 May 2009 08:32:53 +0000 (18:32 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 19 May 2009 08:32:53 +0000 (18:32 +1000)
summary

diff --git a/summary b/summary
index b5fc2875a0d5e32522ba2a8ad696d8db75f94e81..00da3b8b063107654b5eb3bad1f8f4ef52346c6e 100755 (executable)
--- a/summary
+++ b/summary
@@ -32,6 +32,8 @@ trees=$(grep -v '^#' ../real_control | awk -F '       ' '{ printf("%s ", $3); }')
 seen_ids=""
 seen_heads=""
 seen_sha1s=""
+total_commits=0
+total_diff=0
 
 plog '%-20s %7s' "Tree" "commits"
 [ "$prev" ] &&
@@ -60,8 +62,10 @@ for t in $trees; do
        rh=$(git rev-parse $h)
        [ "$mb" = "$rh" ] && {
                plog '%-20s %7d' $t 0
-               [ "$prev" ] &&
+               [ "$prev" ] && {
                        plog ' %+7d' $((0 - prev_num))
+                       total_diff=$((total_diff - prev_num))
+               }
                plog '\n'
                continue
        }
@@ -70,8 +74,10 @@ for t in $trees; do
        seen_heads="$seen_heads ^$rh"
        [ -z "$c" ] && {
                plog '%-20s %7d' $t 0
-               [ "$prev" ] &&
+               [ "$prev" ] && {
                        plog ' %+7d' $((0 - prev_num))
+                       total_diff=$((total_diff - prev_num))
+               }
                plog '\n'
                continue
        }
@@ -91,11 +97,21 @@ for t in $trees; do
 #      log $t \($(echo "$c" | wc -w) $(echo "$c1" | wc -w)\)
        num=$(echo "$c1" | wc -w)
        plog '%-20s %7d' $t $num
-       [ "$prev" ] &&
+       [ "$prev" ] && {
                plog ' %+7d' $((num - prev_num))
+               total_diff=$((total_diff + num - prev_num))
+       }
        plog '\n'
+
+       total_commits=$((total_commits + num))
 done
 
+log
+plog '%-20s %7d' 'Total' $total_commits
+[ "$prev" ] &&
+       plog ' %+7d' $total_diff
+plog '\n'
+
 log
 git shortlog --no-walk $seen_sha1s 2>&1 | tee -a $LOG_FILE