tags:

views:

54

answers:

4

I have a bit of code that I would like to see revision history for. In the example file, line 300 contains something "interesting". How can I use svn to see when that line has been changed and review the svn comment(s) that pertain to the changing of that line. (Note that previous revisions of that file will likely not have my target line of interest at line 300).

+2  A: 

There's the "svn blame" tool for that.

kusma
Best command ever! Except when my name comes up...
RedFilter
They have an "svn praise" alias for it also, perhaps that will suit you better if you have a bad feeling? ;)
kusma
A: 

svn blame filename

Then look at the log for the revision in which it was changed.

Michael Hackner
+1  A: 

You could use SVN's blame command. This will print author and revision numbers on a per-line basis for the specified target. Once you have the revision number you can review the commit logs and other changes associated with that revision using log, etc.

Josh Petrie
Also known as svn annotate, if you're feeling less vindictive. (Or your boss wrote the code and is looking over your shoulder.)
jmanning2k
A: 

As others have already mentioned, you can use:

svn annotate filename

to show when that line was last modified. Do be careful though, since that will show the last time that anything on that line was modified. So, if the code was moved in the file, that is deleted from one place, and pasted somewhere else, it will show when the line was moved, not necessarily when it was modified. The same goes if the line was moved into, or out of, a loop, or if statement.

Paul Wagland
Annotate sounds better than blame. At least for what I needed at the time. :-)
Les