"git grep" equivalent in Subversion?
I'm a big fan of git grep. Does an equivalent exist in Subversion?
As answered in Exclude .svn directories from grep:
grep --exclude-dir=".svn"
This svngrep
function provides basic funtionality similar to git grep
:
svngrep() { grep --color=always --exclude-dir=".svn" -r "$1" . | less -R; }
to paste in your .bashrc
.
While not a perfect solution, I use the following to grep through revisions of a specific file:
for rev in `svn log FILE_TO_SEARCH | grep '^r[0-9][0-9]* ' | cut -f1 -d" "`; do svn cat -$rev FILE_TO_SEARCH 2>/dev/null | grep -q PATTERN_TO_FIND && echo $rev;done
The output is a list of revision numbers of that file that contain the string.