#3023 closed enhancement (duplicate)
The ability to see the history of a particular line of code would be useful
Reported by: | sprewell | Owned by: | Jonas Borgström |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | version control/browser | Version: | 0.9.4 |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Let me begin by saying that trac is a great way to go looking through source code and trace the evolution of a source tree. However, when I click on the line number of a line of code right now, it links to a named anchor to that line. It would be nice if there were also a link to all the diffs that modified or introduced that line of code. This might take some work, as it would involve checking to see if the previous line that was there was substantially similar to the current line, but it would be worth it. This feature would allow tracing the history of particular lines or functions over time, something very useful to figure out what's going on with the source code now.
Attachments (0)
Change History (5)
comment:1 by , 18 years ago
Keywords: | svn blame added |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
comment:2 by , 18 years ago
Keywords: | svn blame removed |
---|---|
Resolution: | duplicate |
Status: | closed → reopened |
Not exactly. From what I can tell, svn blame will tell you the revision number of the last diff that modified every line of a file, including the author and timestamp and optionally up to a certain revision number. What I had in mind is to take this information and build a better UI around it. Let me illustrate with an example. Suppose there's a line in a file that says
line 55: foo = myburrito.eat.(now).but "not all of it"
I could click on that line and see all the diffs that were made in the past that changed any source within a 10-line neighborhood of that line, going back to the point in time when there was no line 55 in the file. The UI would be similar to the one for changesets now, except that there would be a list of diffs at the top of the page (that changed that neighborhood of lines) and the rest of the page would consist of the green and red highlighted diff images showing how those 10 lines were modified by each revision. One can imagine this expanded to analyzing how particular functions/methods changed over time or even to only finding lines that were a strict ancestor of the current line (ie they implemented similar functionality). Of course, these features would require more parsing work and would not be necessary right away.
In terms of implementation, perhaps you're asking me about svn blame because you generally use the functionality that svn provides for trac and svn doesn't provide this functionality directly. However, by analyzing the diff info from svn, I believe this feature could be hacked up fairly quickly, though it may require storing the info in a separate database (for the case when svn doesn't provide quick access and you don't want to have to parse the same files every time a request is made).
comment:3 by , 18 years ago
How would you define the difference between when a line is modified and when a line is replaced?
comment:4 by , 18 years ago
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
This should be implemented by the blame support (#629). The ability to see the history of a particular line of code should be achieved by having links in the revision annotation column that will jump to the previous annotated revision of the file, providing a simple user interface to peel off revisions.
e.g.
... rev 12 (prev) | 100 | def hello(txt): rev 13 (prev) | 101 | print 'Hello!', txt rev 12 (prev) | 102 | print 'Done' ...
Following the (prev) link on line 101 will show the annotated file just before the rev 13, effectively allowing you to follow the history of line 101:
... rev 12 (prev) | 100 | def hello(txt): rev 12 (prev) | 101 | print 'Hello there!', text rev 12 (prev) | 102 | print 'Done' ...
But this should be part of #629, so I'm closing this as duplicate again.
comment:5 by , 18 years ago
Note that in the blame feature for 0.11 (as currently implemented in source:sandbox/blame), the above functionality can be achieved, but not using the UI suggested above. Actually it would have been to costly to keep track of the correct line number in the (prev)
link above (that would have required us to reimplement our own blame algorithm instead of using the one provided by the VC backend). Instead, we can use the block level link for the old revision found in the changeset view for that changeset.
In the example above, clicking on the rev 13
column on line 101 will show a changeset view panel, in which the actual diff for line 101 will be shown. By clicking on the r12
link in that diff block, one goes to the previous annotation view (here at line 101 also, but even in the general case, an appropriate line number will be used).
So you'd like to have a
svn blame
feature integrated with Trac? This corresponds to #629.