Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

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.

I was looking for the same feature and i end up here and i quit looking any further.

But here is a technique i am using and it may help anyone else:

  1. Identify the line of interest. Last call it: line 123.
  2. Use to Tortoise to "show log" of the file.
  3. Consider the full list in the log.
  4. If you have no idea when it could have happened, use the "quick sort mindset", i mean, go to the revision in middle of the list, right click and "compare with working copy".
  5. If the line 123 exists (same content, but probably a different line number), then you should now consider only the bottom half of the list, else you should now consider only the top half of the list. Go back to step 4.

It is easier to do than to explain. Since this text is target for developers, I understand there is no need to add more details :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top