Skip to content

Instantly share code, notes, and snippets.

@neilxp
Created October 19, 2011 06:26
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save neilxp/1297604 to your computer and use it in GitHub Desktop.
Save neilxp/1297604 to your computer and use it in GitHub Desktop.
Analyze SVN committer productivity
#!/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=vr
password=reader
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 -d '-1 day' +%Y-%m-%d`
revisions=$(svn log -r{$today}:{$yesterday} --username $uname --password $password |grep $user'\ '|awk '{print $1}')
lastrev=init
for rawrev in $revisions
do
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment