Skip to content

Instantly share code, notes, and snippets.

@pboissonneault
Forked from lapo-luchini/svn-grep
Created November 17, 2015 18:30
Show Gist options
  • Save pboissonneault/3800a35349c9e8bf4d47 to your computer and use it in GitHub Desktop.
Save pboissonneault/3800a35349c9e8bf4d47 to your computer and use it in GitHub Desktop.
A script to grep the whole SVN history of a file.
#!/bin/sh
FILE="$1"
shift
PARAM="$@"
svn log -q "$FILE" | egrep '^r[0-9]+' | while read REV ALL; do
OUT=`svn cat -r $REV "$FILE" | egrep -n "$PARAM"`
if [ $? -eq 0 ]; then
echo "====> $REV $ALL"
echo "$OUT"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment