[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

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

From: OBones <obones_at_free.fr>
Date: Mon, 26 Mar 2012 15:18:32 +0200

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
Received on 2012-03-26 15:19:39 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.