[releng] add git contributor stats



commit 4c1f555d34a23796b68bf85af5f5cb90e37cca2b
Author: Olav Vitters <olav vitters nl>
Date:   Wed Sep 14 16:28:38 2011 +0200

    add git contributor stats

 tools/contributions/get-git-stats |   56 +++++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)
---
diff --git a/tools/contributions/get-git-stats b/tools/contributions/get-git-stats
new file mode 100755
index 0000000..cde3282
--- /dev/null
+++ b/tools/contributions/get-git-stats
@@ -0,0 +1,56 @@
+#!/bin/sh
+# vim: set ts=4:
+
+SINCE="2011-04-06"
+
+statdir=`pwd`
+
+mkdir -p top-10
+
+> "$statdir"/all-authors
+
+echo -e "module\tcommits\tcommitters\tauthors"
+
+for d in ~/src/*; do
+
+	if [ ! -d "$d" ]; then
+		continue
+	fi
+
+	# check it is from gnome
+	cd "$d"
+	git config --get remote.origin.url | grep -q gnome || continue
+
+	module=$(basename "$d")
+
+	# Total number of commits:
+	commits=$(git log --after=$SINCE --pretty=oneline | wc -l)
+
+	if [ "$commits" == "0" ]; then
+		committers=0
+		authors=0
+	else
+
+			# 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)
+
+			# 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)
+
+			# 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"
+
+			git log --after=$SINCE --author='' --pretty=format:"%ae" >> "$statdir"/all-authors
+
+	fi
+
+	echo -e "$module\t$commits\t$committers\t$authors"
+done
+
+cd "$statdir"
+
+authors=$(cat all-authors | sort -u | wc -l)
+echo -e "TOTAL\t?\t?\t$authors"
+



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