Fossil

Check-in [91af24e6]

Many hyperlinks are disabled.

Overview
Comment: Add the /doc/trunk/www/blame.wiki document briefly describing the algorithm used to compute "blame" in Fossil. Tarball | ZIP archive | SQL archive family | ancestors | descendants | both | files | file ages | folders 91af24e6c942da9d2b7faa14443f7aad908ec182 drh 2015-12-13 02:55:09
Context
 2015-12-13 03:13 Fix one error and add an additional note to the article on the annotate algorithm. check-in: 9828493c user: drh tags: trunk 02:55 Add the /doc/trunk/www/blame.wiki document briefly describing the algorithm used to compute "blame" in Fossil. check-in: 91af24e6 user: drh tags: trunk 02:11 Enhance the /finfo webpage so that when it is showing the ancestors of a particular check-in, it only shows direct ancestors, the same as the /annotate and /blame pages. check-in: f8db2c74 user: drh tags: trunk
Changes

 ``` ``` ``` ``` ```> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ``` ```1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 ``` ```The Annotate Algorithm

1.0 Introduction

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.

2.0 Algorithm

1. Locate the check-in that contains the file that is to be annotated. Call this check-in C0.
2. Find all direct ancestors of C0. A direct ancestor is the closure of the primary parent of C0. Merged in branches are not part of the direct ancestors of C0.
3. Prune the list of ancestors of C0 so that it contains only check-in in which the file to be annotated was modified.
4. Load the complete text of the file to be annotated from check-in C0. Call this version of the file F0.
5. Parse F0 into lines. Mark each line as "unchanged".
6. For each ancestor of C0 on the pruned list (call the ancestor CX), beginning with the most recent ancestor and moving toward the oldest ancestor, do the following steps:
1. Load the text for the file to be annotated as it existed in check-in CX. Call this text FX.
2. Compute a diff going from FX to F0.
3. For each line of F0 that is changed in the diff and which was previously marked "unchanged", update the mark to indicated that line was modified by CX.
7. Show each line of F0 together with its change mark, appropriately formatted.

3.0 Discussion and Notes

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 where 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 (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 2. ```

Changes to www/mkindex.tcl.

 ```6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ``` ```# tclsh mkindex.tcl >permutedindex.html # set doclist { adding_code.wiki {Adding New Features To Fossil} adding_code.wiki {Hacking Fossil} antibot.wiki {Defense against Spiders and Bots} bugtheory.wiki {Bug Tracking In Fossil} branching.wiki {Branching, Forking, Merging, and Tagging} build.wiki {Compiling and Installing Fossil} checkin_names.wiki {Check-in And Version Names} checkin.wiki {Check-in Checklist} changes.wiki {Fossil Changelog} copyright-release.html {Contributor License Agreement} concepts.wiki {Fossil Core Concepts} contribute.wiki {Contributing Code or Documentation To The Fossil Project} ``` ``` | > ``` ```6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ``` ```# tclsh mkindex.tcl >permutedindex.html # set doclist { adding_code.wiki {Adding New Features To Fossil} adding_code.wiki {Hacking Fossil} antibot.wiki {Defense against Spiders and Bots} blame.wiki {The Annotate/Blame Algorithm Of Fossil} branching.wiki {Branching, Forking, Merging, and Tagging} bugtheory.wiki {Bug Tracking In Fossil} build.wiki {Compiling and Installing Fossil} checkin_names.wiki {Check-in And Version Names} checkin.wiki {Check-in Checklist} changes.wiki {Fossil Changelog} copyright-release.html {Contributor License Agreement} concepts.wiki {Fossil Core Concepts} contribute.wiki {Contributing Code or Documentation To The Fossil Project} ```

Changes to www/permutedindex.html.

 ```22 23 24 25 26 27 28 29 30 31 32 33 34 35 ... 170 171 172 173 174 175 176 177 178 179 180 181 182 183 ``` ```
• 5 Minutes as a Single User — Update and Running in
• 2010 IDE — Integrating Fossil in the Microsoft Express
• A Technical Overview Of The Design And Implementation Of Fossil
• Adding New Features To Fossil
• against Spiders and Bots — Defense
• Agreement — Contributor License
• Algorithm — Fossil Delta Encoding
• Appearance of Web Pages — Theming: Customizing The
• as a Single User — Update and Running in 5 Minutes
• Asked Questions — Frequently
• Authentication — Password Management And
• Bots — Defense against Spiders and
• Branches — Creating, Syncing, and Deleting Private
• Branching, Forking, Merging, and Tagging
• ................................................................................
• Syncing, and Deleting Private Branches — Creating,
• System — Customizing The Ticket
• System — The Fossil Ticket
• Tagging — Branching, Forking, Merging, and
• Technical Overview Of The Design And Implementation Of Fossil — A
• Testing Checklist — Pre-Release
• TH1 Scripting Language — The
• The Fossil Build Process
• The Fossil Sync Protocol
• The Fossil Ticket System
• The Fossil Web Interface
• The TH1 Scripting Language
• Theming: Customizing The Appearance of Web Pages
• Theming: Customizing the Timeline Graph
• ``` ``` > > > ``` ```22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 ... 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 ``` ```
• 5 Minutes as a Single User — Update and Running in
• 2010 IDE — Integrating Fossil in the Microsoft Express
• A Technical Overview Of The Design And Implementation Of Fossil
• Adding New Features To Fossil
• against Spiders and Bots — Defense
• Agreement — Contributor License
• Algorithm — Fossil Delta Encoding
• Algorithm Of Fossil — The Annotate/Blame
• Annotate/Blame Algorithm Of Fossil — The
• Appearance of Web Pages — Theming: Customizing The
• as a Single User — Update and Running in 5 Minutes
• Asked Questions — Frequently
• Authentication — Password Management And
• Bots — Defense against Spiders and
• Branches — Creating, Syncing, and Deleting Private
• Branching, Forking, Merging, and Tagging
• ................................................................................
• Syncing, and Deleting Private Branches — Creating,
• System — Customizing The Ticket
• System — The Fossil Ticket
• Tagging — Branching, Forking, Merging, and
• Technical Overview Of The Design And Implementation Of Fossil — A
• Testing Checklist — Pre-Release
• TH1 Scripting Language — The
• The Annotate/Blame Algorithm Of Fossil
• The Fossil Build Process
• The Fossil Sync Protocol
• The Fossil Ticket System
• The Fossil Web Interface
• The TH1 Scripting Language
• Theming: Customizing The Appearance of Web Pages
• Theming: Customizing the Timeline Graph
• ```