12

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?

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 
| improve this answer | |
5

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.

| improve this answer | |
  • I don't see the opinion, it all looks like good advice to me :P – Phoshi Apr 20 '10 at 10:55
  • 1
    This is the same as my approach. I want something simplier/faster than looking in 10 revisions. – Ivan Petrushev Apr 20 '10 at 11:40
  • ...it's 10 revisions. By the time you posted the above question you could be done by now. Unless this is something you will have to do over again, in which case disregard my comments. – ta.speot.is Apr 20 '10 at 12:08
  • 2
    Yep, it is excellent for a single shot, but I need something that can be used often on a regular basis. – Ivan Petrushev Apr 20 '10 at 13:43
3

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.