« Return to Thread: Call svn cat for all files modified or added in a given revision

Re: Call svn cat for all files modified or added in a given revision

by OBones-2 :: Rate this Message:

| View in Thread

Andy Levy wrote:
> svn log --verbose -rX will give you a list of all paths touched in
> revision X. You'll need to do some parsing to extract just the paths
> vs. the other log data. If you're handy with XML, you can use svn log
> --verbose --xml -rX and then use XPath to extract just the paths.
I have taken this route and came up with the script below.
It might not be the best script ever, but it worked just fine for me,
allowing to discover that there was only one revision in the entire
history that was causing issue with svn cat.

Regards
Olivier

---------------------------------------------------

#!/bin/bash

# for this to work, you have to use xpathtool from the following page:
# http://www.semicomplete.com/projects/xpathtool/

# set those variables to match your installation
BASEURL=https://jvcl.svn.sourceforge.net/svnroot/jvcl
USER=
PASS=
MINREV=13281
XPATHTOOLDIR=~/xpathtool-20071102/xpathtool

echo Retrieving maximum revision
MAXREV=`svn log -r HEAD --xml --username=$USER --password=$PASS
--no-auth-cache $BASEURL | $XPATHTOOLDIR/xpathtool.sh
"/log/logentry/@revision"`

REV=$MINREV
while [ $REV -le $MAXREV ]; do
         echo Processing revision $REV out of $MAXREV

         FILES=`svn log --verbose -r $REV --xml --username=$USER
--password=$PASS --no-auth-cache $BASEURL | $XPATHTOOLDIR/xpathtool.sh
"/log/logentry/paths/path[@kind='file'][@action!='D']"`

         IFS=$'\n'
         for FILE in $FILES
         do
                 svn cat --username=$USER --password=$PASS
--no-auth-cache $BASEURL$FILE@$REV > /dev/null
                 if [ $? -ne 0 ]; then
                         echo File $FILE at revision $REV gave an error
                 fi
         done
         let REV=REV+1
done

 « Return to Thread: Call svn cat for all files modified or added in a given revision