Created
July 2, 2009 15:18
-
-
Save ubermuda/139517 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# usage: ./svngrep http://svn.example.com/trunk/file foobar | |
# | |
# This example will look for the string foobar in all rev of file | |
# | |
# @todo better argv handling | |
# @todo add a --verbose option | |
# @todo automatic branches and tags detection (?) | |
SVN_URL=$1 | |
NEEDLE=$2 | |
REV_MIN=`svn log $SVN_URL --xml | grep revision | tail -1 | grep -Eo '[0-9]+'` | |
REV_MAX=`svn log $SVN_URL --xml | grep revision | head -1 | grep -Eo '[0-9]+'` | |
echo "checking revisions $REV_MIN to $REV_MAX..." | |
for REV in `seq $REV_MIN $REV_MAX`; do | |
RESULT=`svn cat -r $REV $SVN_URL | grep -n $NEEDLE` | |
if [ ! -z "$RESULT" ]; then | |
echo "found in rev $REV:" | |
echo $RESULT | |
fi | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment