FossilRepo

Diffs look different from original Fossil diffs

Fixed

6f0a07be6669f69… · opened 3 days, 2 hours ago

Type
Code_Defect
Priority
Severity
Important
Resolution
Fixed
Subsystem
Created
April 8, 2026 1:39 p.m.

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.

Comments (1)

system 3 days, 2 hours ago

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)

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button