SVN: Shell script to get a modified files report of all sub-directories which are all a separate SVN folder

For our automated build we wanted a simple way to generate a report of all files which have changed between two SVN revisions.
’svn log -v‘ usually gives you such an output.

But in our scenario we have a folder /source which contains about 100 sub-directories. The way svn in this project was organized, each sub-folder had to be checked out separately , thus we could not just do a simple ’svn log‘ on /source, because /source itself was not under version control.

We wanted to execute svn log -v for each sub-folder and write the results into a file. In addition only write the output for sub-folders which really had changes between the two svn revisions.

Here is our little script which does the trick:

#put this into a file
output1=$(svn log -v -r $2:$3 $1)
if [[ "$output1" == *"line"* ]]
 echo "Changes in $1 for revision $2 to $3 (command: svn log -v -r $2:$3 $1)"
 echo "$output1"

This script also checks if the output contains the word ‚line‘ which is an indicator that there are changes in this revision. This has been tested with SVN Version 1.6.15 (r1038135).

Now go to the folder with all those sub-folders and execute the script:

cd /source
find . -maxdepth 1 -type d -exec {} 6654 6694  \; > svnlog.txt

6654 is the start revision and 6694 is the target revision.

This command basically executes the script for each folder.

Hope that helps somebody.

Dieser Beitrag wurde unter Software-Development abgelegt und mit , , , , verschlagwortet. Setze ein Lesezeichen auf den Permalink.