Searching through Subversion history


/ Published in: Bash
Save to your folder(s)

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

$ svngrep SecItemCopyMatching *


Copy this code and paste it in your HTML
  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;

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.