Posted By

zingo on 04/11/10


Tagged

svn search subversion grep history


Versions (?)

Searching through Subversion history


 / Published in: Bash
 

URL: http://atastypixel.com/blog/2010/03/09/searching-through-subversion-history/

grep through all history from within a Subversion working directory, like:

$ svngrep SecItemCopyMatching *

  1. #!/bin/sh
  2. pattern=$1
  3. shift
  4.  
  5. for file in $@;
  6. do
  7. svn log -q "$file" 2>/dev/null | perl -ne 'print "$1\n" if /^r(\d+)/' |
  8. while read r
  9. do
  10. match=`svn cat -r $r "$file" | grep "$pattern"`
  11. result=$?
  12. if [ $result -eq 0 ]
  13. then
  14. /bin/echo -n "$file @r$r: "
  15. /bin/echo $match;
  16. elif [ $result -ne 1 ]
  17. then
  18. exit 2
  19. fi
  20. done
  21. done;

Report this snippet  

You need to login to post a comment.