Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to view the history of a line in SVN? [duplicate]

Possible Duplicate:
History of changes to a particular line of code in Subversion?

Using SVN and/or Tortoise SVN (or any other SVN tool, really), is it possible to view the history for a specific line of a file?

Recently I've had several occurrences of coming across a line in a file and wanting to find the log entry associated with its creation (either to determine how old the line of code was, or to get a larger context for why it was added).

Right now I'm doing this by hand. I can display the log for the file, go back a ways, and see if the line in question is present. If it is, I go back further. If it isn't, I go look at a more recent revision. Repeat until the revision where the change was made is found.

Needless to say, this process is awkward at best, especially for particularly old files. Does anyone know of an automated method of accomplishing this?

like image 965
AaronSieb Avatar asked Oct 20 '08 18:10

AaronSieb


2 Answers

I am not sure blame alone does what the asker needs.

I have found the TortoiseSVN command "blame changes" to be handy. It runs a blame on two revisions and compares them together in the diff tool.

The result gives you what the line currently is, what it was at the targeted revision, and who modified it. This works best when you select two consecutive revisions.

You can access this by using "Show Log", right clicking on the file in the lower pane and selecting "blame changes".

Also, for anyone who does not like the term "blame", you can run "svn praise", which gives the same results. :)

like image 73
Mike Miller Avatar answered Oct 13 '22 02:10

Mike Miller


More specifically, you can use "svn blame" with some arguments to look at specific revisions. That can be large per file... svn blame -r REV#

iterating through multiple revisions (if you working from the command line) is a quick script.

like image 34
heckj Avatar answered Oct 13 '22 00:10

heckj