Re: [fossil-users] Is there a way to see history (e.g., annotate) for a single line of code?

2017-08-03 Thread Kevin
Tony,

there is a SCM used on IBM Mainframes called ENDEVOR that gives this
type of history. see https://en.wikipedia.org/wiki/Endevor

and https://www.ca.com/us/products/ca-endevor-software-change-manager.h
tml

The other products were called Panvalet and Librarian.

I can no longer provide cut & paste examples, but maybe someone on the
list can. Maybe the CA sites have some examples.




The rough algorithm is illustrated by the following example.



The way it works is that the first "check-in" is level 0, say, in May
1990. Say the code is in COBOL. There is no DIFF, as it is the first
add.

Say the code is lines 500 to 503:
500   MOVE SPACES TO CUST-NAME.
501   MOVE ZEROES TO CUST-PHONE.
502   MOVE "BEER" TO CUST-FAVE-DRINK.

The code is "checked-out" (and locked or owned) by a developer in Dec
1990, modified with an modification and a deletion, and then "checked-
in" in Feb 1991. This is level 1.

500   MOVE SPACES TO CUST-NAME.
501 -001  MOVE ZEROES TO CUST-PHONE.
502 -001  MOVE "BEER" TO CUST-FAVE-DRINK.
502 +001  MOVE "CIDER" TO
CUST-FAVE-DRINK.

In March 1992, another developer, "checked-out" and then "checked-in" (level 2) 
one new line.

500   MOVE SPACES TO CUST-NAME.
501 -001  MOVE ZEROES TO CUST-PHONE.
502 +002  MOVE "RASBERRY" TO CUST-FAVE-JAM-OR-CONSERVE.
503 -001  MOVE "BEER" TO CUST-FAVE-DRINK.
503 +001  MOVE "CIDER" TO CUST-FAVE-DRINK.


The diff output can be toggled to give the current "check-in", in this case the 
"BEER" line and the CUST-PHONE line would not be shown. Or, deleted lines are 
excluded. Modified lines are inserts(+) and deletes(-).

Note, the parallel diff with colours in Fossil wouldn't quite suit a 3 or 4 
version comparison. 


Large block inserts and deletes, and changing indentation were a challenge.




COBOL has a line structure:

Cols 1-6, numbering (optional)
Col 7 - either space for a code line or '*' for a comment line
Cols 8 thru 72 the code or comment
Cols 73 thru 80, numbering (optional) - some people used these columns for 
version control - effectively a small inline comment 

This 'fixed' format made it a bit easier.

regs,

Kev






---
Date: Tue, 1 Aug 2017 15:01:18 +0300
From: "Tony Papadimitriou" 
To: "Fossil SCM user's discussion" 
Subject: [fossil-users] Is there a way to see history
(e.g.,annotate)
for a single line of code?

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?

Thanks.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Is there a way to see history (e.g., annotate) for a single line of code?

2017-08-01 Thread Warren Young
On Aug 1, 2017, at 12:45 PM, Warren Young  wrote:
> 
> ...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.

I guess you could use the “bloodhound algorithm:” at the point where the line 
moves and changes, stop the output and make the user give you a new line number 
and checkin ID, as with a bloodhound who has lost the scent running around 
until he finds the scent trail again.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Is there a way to see history (e.g., annotate) for a single line of code?

2017-08-01 Thread Warren Young
On Aug 1, 2017, at 6:44 AM, Richard Hipp  wrote:
> 
> On 8/1/17, Tony Papadimitriou  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
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Is there a way to see history (e.g., annotate) for a single line of code?

2017-08-01 Thread Richard Hipp
On 8/1/17, Tony Papadimitriou  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?

Another thing that is needed:  Given an historical check-in, I
sometimes want to see the annotation going forwards in time.  In other
words, for some historical check-in, I want to see the next change for
each line in the file.  This is tricky because of the way the change
graph is constructed.  It is easy to go back in time since every
check-in has a well-defined primary parent.  But going forwards in
time is hard because a single check-in can have an arbitrary number of
children, and so it is difficult to know which child path to follow.

-- 
D. Richard Hipp
d...@sqlite.org
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


[fossil-users] Is there a way to see history (e.g., annotate) for a single line of code?

2017-08-01 Thread Tony Papadimitriou
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?

Thanks.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users