There was a need to get per user contributions in a project last year.
That project was versioned using Subversion (svn).
At last we came up with the following script, which surely is not fool proof, provides an over all per user contribution.
Here it's:
However, I left it to you to improve further; who knows the unmodified version might be good enough for you.
That project was versioned using Subversion (svn).
At last we came up with the following script, which surely is not fool proof, provides an over all per user contribution.
Here it's:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ svn ls -R | egrep -v -e "\/$" | xargs svn blame | awk '{print $2}' | sort | uniq -c | sort -r | |
$ echo "Now let's bisect the above one liner" | |
$ svn ls -R # will list all files in svn repo recursively | |
$ svn ls -R | egrep -v -e "\/$" # get files & directories one line at a time | |
$ svn ls -R | egrep -v -e "\/$" | xargs svn blame # do a svn blame on each file (print file content with rev & author info) | |
$ svn ls -R | egrep -v -e "\/$" | xargs svn blame | awk '{print $2}' # get second column which contains svn user name | |
$ svn ls -R | egrep -v -e "\/$" | xargs svn blame | awk '{print $2}' | sort # sort out put (will be based on svn username) | |
$ svn ls -R | egrep -v -e "\/$" | xargs svn blame | awk '{print $2}' | sort | uniq -c # get uniq lines with counts (no of lines contributed by user) | |
$ svn ls -R | egrep -v -e "\/$" | xargs svn blame | awk '{print $2}' | sort | uniq -c | sort -r # sort in reverse order (so user who contributed most comes first) |
However, I left it to you to improve further; who knows the unmodified version might be good enough for you.
Comments
Post a Comment