[releng] add totals, make it a bit faster



commit 00a1603116053604e2f767b25f8f4e3cac1debd7
Author: Olav Vitters <olav vitters nl>
Date:   Wed Sep 14 16:35:23 2011 +0200

    add totals, make it a bit faster

 tools/contributions/get-git-stats |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/tools/contributions/get-git-stats b/tools/contributions/get-git-stats
index cde3282..cdedc7f 100755
--- a/tools/contributions/get-git-stats
+++ b/tools/contributions/get-git-stats
@@ -11,6 +11,8 @@ mkdir -p top-10
 
 echo -e "module\tcommits\tcommitters\tauthors"
 
+allcommits=0
+
 for d in ~/src/*; do
 
 	if [ ! -d "$d" ]; then
@@ -30,19 +32,24 @@ for d in ~/src/*; do
 		committers=0
 		authors=0
 	else
-
+		allcommits=$[$allcommits+$commits]
 			# Check how many different committers for that module exist:
 			# note: This is case-specific
-			committers=$(git log --after=$SINCE --committer='' --pretty=format:"%ce" | sort -u | wc -l)
+
+			git log --after=$SINCE --committer='' --pretty=format:"%ce" > "$statdir"/committers
+			committers=$(sort -u "$statdir"/committers | wc -l)
+
+			cat "$statdir"/committers >> "$statdir"/all-committers
 
 			# Check how many different authors for that module exist:
 			# note: This is case-specific
-			authors=$(git log --after=$SINCE --author='' --pretty=format:"%ae" | sort -u | wc -l)
+			git log --after=$SINCE --author='' --pretty=format:"%ae" > "$statdir"/authors
+			authors=$(sort -u "$statdir"/authors | wc -l)
 
 			# Get 10 most active authors for all the commits, sorted by number of commits:
-			git log --after=$SINCE --author='' --pretty=format:"%ae" | sort | uniq -c | sort -rn | head -n 10 > "$statdir/top-10/$module.csv"
+			sort "$statdir"/authors | uniq -c | sort -rn | head -n 10 > "$statdir/top-10/$module.csv"
 
-			git log --after=$SINCE --author='' --pretty=format:"%ae" >> "$statdir"/all-authors
+			cat "$statdir"/authors >> "$statdir"/all-authors
 
 	fi
 
@@ -51,6 +58,8 @@ done
 
 cd "$statdir"
 
+commits=$allcommits
+committers=$(cat all-committers | sort -u | wc -l)
 authors=$(cat all-authors | sort -u | wc -l)
-echo -e "TOTAL\t?\t?\t$authors"
+echo -e "TOTAL\t$commits\t$committers\t$authors"
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]