14

I work on a very large project (10000+ versions) and sometimes it happened that I need to know who of the other users deleted some line in a file. Is there a way to do that that? I can do svn blame with revision number to check if a line exists in that revision, then see in which revision the line is gone and see who commited that revision, but that procedure is lame with that large project.

Is there a smarter way to do that?

djsmiley2kStaysInside
  • 6,643
  • 2
  • 31
  • 43
Ivan Petrushev
  • 1,719
  • 4
  • 16
  • 28

3 Answers3

6

I would check the history of the file and try and quickly find a revision where that line is present, and then blame between HEAD and that revision.

If the file has gone through 100 revisions since inception then if you binary search through revisions looking for that line you shouldn't have to look at more than 10 different revisions.

John Kugelman
  • 1,751
  • 15
  • 20
ta.speot.is
  • 14,205
  • 3
  • 33
  • 48
5

svn log --diff will identify deletes with "-" in column zero. Grep for "r" also so you can see the revision.

% svn log --diff src/fozbo.cpp -r22222:HEAD | grep -e '^r' -e '^-.*xyzzy'
r22222 | jruser | 2016-07-19 20:16:07 -0400 (Tue, 19 Jul 2016) | 1 line
-   else if ( password== "xyzzy") {

There is also svn log --search but that will only search the commit message.

Robert Calhoun
  • 333
  • 3
  • 9
5

This does what you need automatically, though not very fast because it doesn't use binary search as suggested above:

svn log FILE | egrep '^r[0-9]' | sed -e 's/ .*//' | while read rev; do echo $rev ; svn cat FILE -"$rev" | grep "case STRING" && break  ; done 
Peter Brülls
  • 51
  • 1
  • 1