Is there a way to find an SVN revision by searching for a text string that got removed in the file? I know the exact text to search for and which file to look in, but there are hundreds of revisions.
Click the revision button at top-right and change it to the revision you want. Then right-click your file in the browser and use 'Copy to working copy...' but change the filename it will check out, to avoid a clash.
Display the differences between two paths. The ways you can use svn diff are: Use just svn diff'to display local modifications in a working copy. Display the changes made to TARGET s as they are seen in REV between two revisions.
Your working revision is the your latest update revision. Your working revision may be behind server's latest revision. For example. You update all of your files and get 1002 revision number.
Building on khmarbaise's script, I came up with this:
#!/bin/bash file="$1" REVISIONS=`svn log $file -q --stop-on-copy |grep "^r" | cut -d"r" -f2 | cut -d" " -f1` for rev in $REVISIONS; do prevRev=$(($rev-1)) difftext=`svn diff --old=$file@$prevRev --new=$file@$rev | tr -s " " | grep -v " -\ \- " | grep -e "$2"` if [ -n "$difftext" ]; then echo "$rev: $difftext" fi done
pass the file name and search string on the command line:
xyz.sh "filename" "text to search"
svn diff gives me both the rev where it's added and where it's deleted; I'll leave it here in case it's useful to anyone. There's an error message at the last revision that I don't know how to get rid of (I still got a lot of bash to learn :) ) but the rev numbers are correct.
just a little bash script which filters out the changed lines...If you change pom.xml into your file may with supplemental URL you have what you need...(If you are on Unix like system). Put the following into a script file (xyz.sh) and do a filter on the output.
#!/bin/bash REVISIONS=`svn log pom.xml -q|grep "^r" | cut -d"r" -f2 | cut -d" " -f1` for rev in $REVISIONS; do svn blame -r$rev:$rev pom.xml | tr -s " " | grep -v " -\ \- " done xyz.sh | grep "Text you are searching for"
The printout will be something like:
256 ......
The 256 is the revision in which the change had been made.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With