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?

  • git svn dcommit fails because of assertion error “svn_fspath__is_canonical(child_fspath)” (cygwin)
  • File Management Server in JAVA
  • Am I doing it wrong? Merging SVN changes from trunk into a git branch. Using merge --squash
  • How can I put my git working directory inside dropbox so I can seemlessly work from any dropbox-enabled computer without committing?
  • Temp file with moniker 'svn_delta' already in use at /usr/lib/perl5/vendor_perl/5.14/ line 1024
  • Msbuild and SVN update
  • How do I restrict Apache/GIT access to specific users (ldap/file-based authentication)?
  • Adding older history from svn project with git svn
  • 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.