#!/bin/sh
# This is a script that help you get your team member's productivity
# by analyzing his/her code commiting in SVN repository, for the day before
#
# You can get a rough num for comparing between team members by using it in the way below
# ./svn_ana.sh SVN_ACCOUNT_NAME | wc -l
#
uname=walker
password=123
if [ $# -lt 1 ]
then
echo Usage: $0 ACCOUNT
echo -e " Where ACCOUNT is the SVN acconut name you want to analyze"
exit -1
fi
user=$1
today=`date +%Y-%m-%d`
yesterday=`date -v -1d +%Y-%m-%d`
revisions=$(svn log -r{$today}:{$yesterday} --username $uname --password $password |grep $user'\ '|awk '{print $1}')
echo "$revision"
lastrev=init
for rawrev in $revisions
do
echo "$rawrev"
rev=$(echo $rawrev|tr -d r)
rev2=`expr $rev - 1`
if [ "$lastrev" = "init" ]; then
lastrev=$rev
fi
dummy=$(echo $revisions|grep $rev2)
if [ $? -eq 0 ]
then
continue
fi
svn diff -r$rev2:$lastrev --username $uname --password $password --diff-cmd diff -x -d |grep -v =======================|grep -v '\---'
lastrev=init
done