How to find out which revision contained a certain line in SVN

We would like to trace removal of a single line in a certain file amongst the many revisions to that file in SVN.

I tried looking at various revisions / diffs to see when it was removed, but was unable to find the offending revision. How do we do this using a svn command?

  • Red arrow icon in subclipse
  • Easy way to embed svn revision number in page in PHP?
  • Xcode 5 crashes with SVN version 1.7 - self signed certificate
  • Git: svn log --stop-on-copy equivalent
  • Possible to svn export and include unversioned files?
  • Is it possible to make git svn dcommit result in a single svn commit?
  • IntelliJ and svn:ignore
  • use svn revision number in application version
  • PHP Source Control Server
  • <PBXResourcesBuildPhase UUID=..> attempted to initialize an object with an unknown UUID
  • Hook script execution on client side
  • How To Deploy Your PHP Applications Correctly?
  • 3 Solutions collect form web for “How to find out which revision contained a certain line in SVN”

    If you’re on Linux and you know in which file to look you can use that shell script to output all the revision of that file.

    svn log "$1" -q | grep -oE r[0-9]+ | xargs -t -n1 -r -d '\n' svn cat "$1" -r

    Pass a working copy file name or repository URL as a parameter to this script.

    If everything else fail and you’re doing regular dumps using svnadmin dump without the --incremental switch you could grep for the text in the latest dump file.

    Non-incremental dumps contain the full text for each revision of every files. made a python script for exactly that purpose.

    I know this isn’t pretty, but it would be relatively quick: I would suggest just manually going through the svn revisions for that file using a “human” binary search. If you have 2000 revisions to go through, you would only need to physically look at 12 revisions to narrow it down to the offending revision.

    Let’s say the line was added in r1000 and the latest revision is r3000. Then check r2000, if the line still exists there, pick a revision halfway between r2000 and r3000 (ie r2500), otherwise pick a revision halfway between r1000 and r2000 (ie r1500). Just continue using this manual search algorithm to narrow it down. With a window of 2000 revisions, you should get it within 12 iterations. (2000, 1000, 500, 250, 125, 64, 32, 16, 8 ,4, 2, 1, bingo!)

    Git Baby is a git and github fan, let's start git clone.