History of changes to a particular line of code in Subversion
I'd usually:
- Run
svn blame FILE
first. - Note the last revision of the particular line.
Do another query with the
-r
argument:svn blame FILE -r 1:REV
- Trace manually from there.
I don't know a method for tracking statements through time in Subversion.
It is simple however to see when any particular line in a file was last changed using svn blame
. Check the SVNBook: svn blame
reference:
Synopsis
svn blame TARGET[@REV]...
Description
Show author and revision information in-line for the specified files or URLs. Each line of text is annotated at the beginning with the author (username) and the revision number for the last change to that line.
In the TortoiseSVN client there is a very nice feature that lets you:
- blame a file, displaying the last change for each line (this is standard)
- "blame previous revision", after clicking on a particular line in the above view (this is the good one)
The second feature does what it says - it shows the annotated revision preceding the last modification to the line. By using this feature iteratively, you can trace back through the history of a particular line.
This can be done in two stages:
svn blame /path/to/your/file > blame.tmp
grep "your_line_of_text" blame.tmp
You can delete blame.tmp file afterwards if you don't need it.
In principle, a simple script can be written in any scripting language that does roughly the same.