One function

_contributions in thatch/moreorless

The author described this change as Fix missing f-prefix on error strings in combined.py. It counts as a record because the check below fails on the code as it stood at 6b32e3fe6 and passes on 9443a9ace, with nothing else changed between the two runs.

Fix saved2026-05-12
Sharing licenceMIT · LICENSE
Change size+2 2

What the code was meant to do, written into the code itself as a docstring

Calculate the contribution of various lines to the final result. Instead of storing the +/- symbols directly, we will store 1 in the column if the line exists in that file. This intermediate form is very simple to look for snip points (more than 2*context runs of `(1, ...)`), and has the nice property that once you transpose to get columns, the `@@` lines for indices `i:j` start at `sum(col[:i])` and are `sum(col[i:j])` long.

The change

1616 """
1717 if merge_mode:
1818 if len(to_files) != 1:
19- raise ValueError("Can't merge_mode=True with to_files={len(to_files)}")
19+ raise ValueError(f"Can't merge_mode=True with to_files={len(to_files)}")
2020 common = to_files[0]
2121 rest = from_files
2222 else:
2323 if len(from_files) != 1:
24- raise ValueError("Can't merge_mode=False with from_files={len(from_files)}")
24+ raise ValueError(f"Can't merge_mode=False with from_files={len(from_files)}")
2525 common = from_files[0]
2626 rest = to_files
2727

The check that tells the two apart

failpass·tests/test_combined.py::test_contributions_exception_messages

Check file tests/test_combined.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it6b32e3fe66de846ecbf4cc978c95542f892ba8f7
Broken version dated2026-05-12
Modulemoreorless.combined
Units changed_contributions
Fingerprint021dadec33951116
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in thatch/moreorless