| Ticket Hash: | 6f0a07be6669f6995b9af87933a7a502b53627fd | ||
| Title: | Diffs look different from original Fossil diffs | ||
| Status: | Fixed | Type: | Code_Defect |
| Severity: | Important | Priority: | Important |
| Subsystem: | Resolution: | Fixed | |
| Last Modified: |
2026-04-14 04:59:58 17.1 hours ago |
Created: |
2026-04-08 13:39:54 6.4 days ago |
| Version Found In: | |||
| Description: | ||||
|
Diffs displayed on fossilrepo.io look different from the original diffs on fossil-scm.org for the same checkin.
Reported by: Florian Balmer on the Fossil forum (forumpost/4662a5e151) COMPARISON (checkin c90e810f3fc8): - fossilrepo.io: projects/fossil-scm/fossil/checkin/c90e810f3fc83a8bd0da3d38c3bd975c7323e1782469f9848cf97e36dca1aeef/ - fossil-scm.org: home/info/c90e810f3fc83a8bd0da3d38c3bd975c7323e1782469f9848cf97e36dca1aeef?diff=1 WHAT'S WRONG: fossil-scm.org (correct) fossilrepo.io (broken) Stats: 1 file, +11 -0 1 file, +159 -1 Hunks: Small focused hunk at lines 469-493 Massive hunk @@ -437,4 +437,162 @@ Effect: Shows only the 11 new lines Shows nearly the entire tail of the file as changed ROOT CAUSE: checkin_detail and compare_checkins views used Python's difflib.unified_diff() to compute diffs. difflib uses the Ratcliff/Obershelp algorithm, which produces different hunk grouping, context, and change detection than Fossil's native LCS-based diff engine. Affected code: - fossil/views.py — checkin_detail() and compare_checkins() FIX: 1. Added FossilCLI.diff() method — runs `fossil diff --from PARENT --to CHECKIN -R REPO` using the native Fossil binary 2. Extracted shared _parse_unified_diff_lines() and _parse_fossil_diff_output() helpers 3. Updated both views with automatic fallback to difflib if fossil binary unavailable Ref: https://fossil-scm.org/forum/forumpost/4662a5e151 GitHub: https://github.com/ConflictHQ/fossilrepo/issues/14 Status: Fixed and deployed. | ||||
| User Comments: | ||||
added on 2026-04-08 13:45:01:
LEARNINGS: The root cause was using Python's difflib (Ratcliff/Obershelp algorithm) instead of Fossil's native LCS-based diff engine. These produce fundamentally different hunk grouping — not just cosmetic differences, but completely different change counts (+159 -1 vs +11 -0). SUMMARY: Replaced difflib with `fossil diff --from --to -R` via FossilCLI.diff(). Added shared _parse_unified_diff_lines() and _parse_fossil_diff_output() helpers. Both checkin_detail and compare_checkins updated with automatic fallback to difflib if fossil binary unavailable. Verified on production: checkin c90e810f now correctly shows +11 matching fossil-scm.org. Files: fossil/cli.py, fossil/views.py Commit: 865d9b0 GitHub: ConflictHQ/fossilrepo#14 (closed) | ||||