Open Bug 1858466 Opened 2 years ago Updated 2 years ago

Lando should store patches as text instead of binary

Categories

(Conduit :: Lando, enhancement)

enhancement

Tracking

(Not tracked)

People

(Reporter: sheehan, Unassigned)

Details

At the moment Lando stores patches in the database as LargeBinary. We retrieve the patch as a Python bytes, which we then decode as a utf-8 str and use to apply to the repo for landings, parse headers etc. When we want to store the patch we encode from str to bytes again.

We should change the DB schema to store patches as text, avoiding the need to convert to bytes in various places and keeping the mental model of patch formats consistent across Lando.

Note that some patches may contain non-UTF-8 text.

(In reply to Masatoshi Kimura [:emk] from comment #1)

Note that some patches may contain non-UTF-8 text.

Which kind of changes are you referring to? IIRC Phabricator stores patches in UTF-8, so if there's some potential incompatibility there we haven't come across it in a while.

Flags: needinfo?(VYV03354)

For example patches touching under dom/encoding/test/ or intl/uconv/tests/. IIRC we had to make the patch binary to avoid UTF-8 restriction imposed by Phabricator.

Flags: needinfo?(VYV03354)

I assume we'd treat non-utf8 files the same as we currently treat actually binary files (eg. images).

For context here's what moz-phab does https://github.com/mozilla-conduit/review/blob/4f2fcbfc5a988384f721cefe8b5b998d2652edf1/mozphab/mercurial.py#L997-L1005

You need to log in before you can comment on or make changes to this bug.