1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
<title>The Annotate Algorithm</title>
<h2>1.0 Introduction</h2>
The [/help?cmd=annotate|fossil annotate],
[/help?cmd=blame|fossil blame], and
[/help?cmd=praise|fossil praise] commands, and the
[/help?cmd=/annotate|/annotate],
[/help?cmd=/blame|/blame], and
[/help?cmd=/praise|/praise] web pages are all used to show the most
recent check-in that modified each line of a particular file.
This article overviews the algorithm used to compute the annotation
for a file in Fossil.
<h2>2.0 Algorithm</h2>
<ol type='1'>
|
|
|
|
|
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
<title>The Annotate Algorithm</title>
<h2>1.0 Introduction</h2>
The [/help/annotate|fossil annotate],
[/help/blame|fossil blame], and
[/help/praise|fossil praise] commands, and the
[/help/www/annotate|/annotate],
[/help/www/blame|/blame], and
[/help/www/praise|/praise] web pages are all used to show the most
recent check-in that modified each line of a particular file.
This article overviews the algorithm used to compute the annotation
for a file in Fossil.
<h2>2.0 Algorithm</h2>
<ol type='1'>
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
<h2>3.0 Discussion and Notes</h2>
The time-consuming part of this algorithm is step 6b - computing the
diff from all historical versions of the file to the version of the file
under analysis. For a large file that has many historical changes, this
can take several seconds. For this reason, the default
[/help?cmd=/annotate|/annotate] webpage only shows those lines that were
changed by the 20 most recent modifications to the file. This allows
the loop on step 6 to terminate after only 19 diffs instead of the hundreds
or thousands of diffs that might be required for a frequently modified file.
As currently implemented (as of 2015-12-12) the annotate algorithm does not
follow files across name changes. File name change information is
available in the database, and so the algorithm could be enhanced to follow
files across name changes by modifications to step 3.
Step 2 is interesting in that it is
[/artifact/6cb824a0417?ln=196-201 | implemented] using a
[https://www.sqlite.org/lang_with.html#recursivecte|recursive common table expression].
|
|
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
<h2>3.0 Discussion and Notes</h2>
The time-consuming part of this algorithm is step 6b - computing the
diff from all historical versions of the file to the version of the file
under analysis. For a large file that has many historical changes, this
can take several seconds. For this reason, the default
[/help/www/annotate|/annotate] webpage only shows those lines that were
changed by the 20 most recent modifications to the file. This allows
the loop on step 6 to terminate after only 19 diffs instead of the hundreds
or thousands of diffs that might be required for a frequently modified file.
As currently implemented (as of 2015-12-12) the annotate algorithm does not
follow files across name changes. File name change information is
available in the database, and so the algorithm could be enhanced to follow
files across name changes by modifications to step 3.
Step 2 is interesting in that it is
[/artifact/6cb824a0417?ln=196-201 | implemented] using a
[https://www.sqlite.org/lang_with.html#recursivecte|recursive common table expression].
|