This page shows a simple script to extract the last two revisions of each file
from SVN.
-
This script performs a svn log on
each file and stores the results in a log file.
-
The bash script uses regular expression to detect if a file, from
the find output list, is valid for svn log. This is done via the
expr match command.
-
- #!/bin/bash
- if [ -e svn_my_log.txt ] ; then
- rm -f svn_my_log.txt
- fi
- for f in `find . -type f`
- do
- ix=`expr match $f '.*\.svn.*'`
- if [ $ix -eq 0 ] ; then
- cmd="svn log "$f" | grep -v \"\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\" | grep \"^r[0-9]* \" | head -2 >> svn_my_log.txt"
- echo $f >> svn_my_log.txt
- eval $cmd
- echo >> svn_my_log.txt
- # else
- # echo "skipped "$f
- fi
- done
|