Don't mangle \n and \r combinations in the generated mboxes

Generated mboxes weren't representing newline (aka LF or \n) and
carriage return (aka CR or \r) found in the original patch faithfully.

This is mostly due to how email.Message is implemented - it tries to
normalize newlines in plain text emails. This doesn't work for us as we
want to provide the patches in an unchanged form.

To do that we have to overwrite as_string() and as_bytes() methods on
our Message class that will use modified Generator that doesn't mangle

The difference in the checksums is due to slightly different header
wrapping caused by the changes in generator.

Additionally tests are provided to make sure that we ingest emails
correctly (no mangling there) and that the generated mbox is also

Fixes: #33
Signed-off-by: Arkadiusz Hiler <>
1 job for master in 1 minute and 24 seconds (queued for 1 second)
Status Job ID Name Coverage
passed #3481303