views:

116

answers:

3

I have one line of code which seems commented. Basically the thing I want to find is the revision that changed this line in the code.

So, is it possible to see changes in code related to a specific keyword in TortoiseSvn Log?

+5  A: 

What you want to do is do a Blame on that source file and it will show you the revisions that changed each of the lines of code.

I'm not aware of any command that would be able to give you all revisions for a given line of code...what you can do is do a show log on a single file and then look at each of the revisions that took place over time.

mezoid
Is there also a way to find *all* revisions a certain line was modified? Blame will only give me the last revision.
0xA3
No, it will only show you who changed the line last. He wanted somethiing that he can point on a line and show in what revisions this line was changed (my understaning of the question).
BeowulfOF
I'm not aware of any such command that would be able to give you all revisions for a given line of code...what you can do is do a show log on a single file and then look at each of the revisions that took place over time.
mezoid
@BeowulfOF If you look at his question he asks for the revision that changed a single line of code....which to me means blame...only in his comment does he seem to clarify that he wants some sort of blame history.
mezoid
Thanks guys, it will be quite useful for my case.
burak ozdogan
A: 

You can right-click on a file in your repo and select TortoiseSVN->Show Log to get the revisions this file was affected by. On a line by line basis, there is no way I know of.

BeowulfOF
+1  A: 

Mezoid's Blame sounds correct. As an aside, I'd like to share a technique that commandline svn users might find useful. (It's about svn blame, but I use the "annotate" synonym, or "svn ann", because "blame" sounds a bit harsh!)

OK, so you have a line you're interested in, and it has a distinctive string on it "distinctiveString". You want to read the commit message when the line was first introduced, but it may have been edited a few times. So, you go ahead and do this:

# svn ann that.file | grep distinctiveString
2345     yada yada distinctiveString blah blah

A look at your TRAC web interface for svn shows that r2345 simply changed the indentation of the line, it wasn't the revision at which the line was introduced. So next you use the -R flag (or -r, do svn help ann to make sure) to specify the revision one less than the revision you found in the previous step:

# svn ann -R 2344 that.file|grep distinctiveString
2211  yada yada distinctiveString blah blah

Rinse and repeat until you find the original.

You can omit the TRAC lookup at each step by simply repeating until you don't see the line any more, and taking the result of the penultimate iteration.

OK, it's a bit laborious, but if you really want to know who introduced that line it will do the job. It can save you time if the original commit message explains the intent of an obscure piece of code that otherwise looks like it could be removed.

Ewan Todd
I like it. I'll have to try that some time.
mezoid