Skip to content

Instantly share code, notes, and snippets.

@kra3
Created September 24, 2012 12:56
Show Gist options
  • Select an option

  • Save kra3/3775813 to your computer and use it in GitHub Desktop.

Select an option

Save kra3/3775813 to your computer and use it in GitHub Desktop.
Script to find per user contributions from an Subversion (svn) repository.
$ 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)
@gerritholl

Copy link
Copy Markdown

That should be sort -rn, otherwise 9380 will sort before '8'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment