On Aug 1, 2017, at 6:44 AM, Richard Hipp <[email protected]> wrote:
>
> On 8/1/17, Tony Papadimitriou <[email protected]> wrote:
>> When doing ‘annotate’ on a certain file version I see the most recent commit
>> responsible for each line in the file. That’s great!
>>
>> However, if I want to know which previous commits (history) touched one
>> specific line, is there some way to do this?
>
> There is not. Can you suggest an algorithm for computing it?
There’s a straightforward algorithm that is not very useful:
1. Get the change history for the file the same way as with “fossil finfo”.
2. Using a modified version of the “fossil diff” algorithm, detect whether the
given numbered line has changed between each pair of checkins. Print the
checkin ID and new line content if so.
3. Get next checkin ID up the timeline and go to 2.
The thing is, that’s only useful if the line specified hasn’t shifted up or
down in the file between checkins.
If the OP wants Fossil to somehow track the movement of lines up and down
within the file while also detecting changes in that line, I think you’d have
to modify step 2 to use a fuzzy diff, causing this new feature to give fuzzy
output.
That is, if the user says
$ fossil annotate --line 1234
it would first do a diff between the current checkout version and the prior
checkin on that branch, then use the diff algorithm’s information to guess how
many lines up or down the line has moved within that prior checkin. If the
line is unchanged, that’s pretty easy, but if it’s moved *and* changed, Fossil
will have to guess based on how many lines were added or removed prior to the
diff point.
I think that would be more useful, though somewhat prone to reporting false
differences. And once it’s latched onto a false difference, it is likely to go
off on a useless tangent, chasing changes to a line you don’t care about.
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users