gets all files details committed to svn by a particular user [or all users] since a particular date

Here is a shell for printing committed person's:

  1. Revision number
  2. Name
  3. Date of commit
  4. Files committed.
  5. committing comment
  6. Date

I just made for my usage. May be helpful for you too.

Do as follows.

create a file
$ vi svn_get_user_committed_files_details.sh
press i
then copy & paste the following as it is. And then make the shell executable with the command chmod.
[Don't forget to change PROJECT path. :)]

Usage :
$ sh svn_get_user_committed_files_details.sh anySvnUName
or
$ sh svn_get_user_committed_files_details.sh

#!/bin/bash
#######Things need to change######### [
PROJECT="/home/smily/workspace/MyProj"
#Date format should be YYYY-MM-DD
DateFrom="2011-12-20"
#DateTo can be in YYYY-MM-DD or HEAD
DateTo="HEAD"
#######Things need to change######### ]

svnfile_log_all="/tmp/svnfile_log_all.txt"
svnListUNames="/tmp/svnListUNames.txt"
svnUserCommitted="/tmp/svnUserCommitted.txt"
uName="$1"

[ $DateTo == "HEAD" ] && DateFromTo="-r {$DateFrom}:HEAD" || DateFromTo="-r {$DateFrom}:{$DateTo}"
[ -f $svnfile_log_all ] && rm -f $svnfile_log_all
[ -f $svnListUNames ] && rm -f $svnListUNames
[ -f $svnUserCommitted ] && rm -f $svnUserCommitted

echo -e "\nPlease wait..\n"
svn log $DateFromTo -v $PROJECT > $svnfile_log_all

if [ -z $uName ]; then
cat $svnfile_log_all | awk -v uName=$uName '/^r[0-9]+ / {user=$3} /./ {print user} ' | grep -v "^$" |sort | uniq >> $svnListUNames
else
  if [ `cat $svnfile_log_all | grep "$uName" | wc -l` -gt "0" ]; then
          echo $uName > $svnListUNames 
  else
          echo -e "\n>>>>>user: $uName not committed any files.<<<<<" 
          exit 0
  fi
fi

echo -e "\n\nRepo Name: `cat $PROJECT/.svn/entries | grep "http://" | head -1`" >> $svnUserCommitted

while read uName
do 
echo -e "\n$uName committed files\n======================" >> $svnUserCommitted
cat $svnfile_log_all | awk -v uName=$uName '/^r[0-9]+ / {user=$3} /./{if (user==uName) {print}}' | grep -E "^   M|^   G|^   A|^   D|^   C|^   U" | awk '{print $2}' | sort >> $svnUserCommitted

echo -e "\n\nIn Detail:\n==========" >> $svnUserCommitted
cat $svnfile_log_all | awk -v uName=$uName '/^r[0-9]+ / {user=$3} /./{if (user==uName) {print}}' >> $svnUserCommitted
echo -e "\n"
done < $svnListUNames

echo -e "Log is in : $svnUserCommitted\n"
cat $svnUserCommitted

Changes / suggestions expected .. :stuck_out_tongue:

Are you asking for help to fix something?
Nice to proactively share a script; however, many (most, and maybe all) probably will not understand its purpose. Without input and output, whatever 'magic' this script does is lost.

@linuxadmin,

Thanks for sharing the script.

Some of the changes you need to do for the script.

Dont use cat and awk together


cat $svnfile_log_all | awk -v uName=$uName '/^r[0-9]+ / {user=$3} /./ {print user} '

change it to

awk -v uName=$uName '/^r[0-9]+ / {user=$3} /./ {print user} ' $svnfile_log_all
dont use cat and grep

cat $PROJECT/.svn/entries | grep "http://"

change it to

grep "http://" $PROJECT/.svn/entries

cat, grep , wc --- you can do it by grep -c

`cat $svnfile_log_all | grep "$uName" | wc -l`

change it to

grep -c $uName $svnfile_log_all

|sort | uniq 

change it to

sort -u
cat $PROJECT/.svn/entries | grep "http://" | head -1

change it to

awk  '/http:\/\// {print; exit}'  $PROJECT/.svn/entries

@itkamaraj ,

  Thanks a lot. I use all the mistakes you told in all my shell. I will change it. Thanks again.

@joeyg,

  Yes. You are right; little confusing for those who dont know about it. Neo also told the same thing; about input n output. Here after i will follow it, if i post a script like this.
   I am not asking anybody to fix anything. Sorry to confuse you. Just posted this script, as I searched hard to get this info , mostly all about svn and it was a failure, and thinking it may help @least some one!!.