( )⚙ D7054 phabricator: treat non-utf-8 text files as binary as phabricator requires

This is an archive of the discontinued Mercurial Phabricator instance.

phabricator: treat non-utf-8 text files as binary as phabricator requires
ClosedPublic

Authored by Kwan on Oct 10 2019, 5:53 PM.

Details

Summary

Phabricator can't cope with text files that are not UTF-8, so requires them to
be submitted as binary files instead. This has the unfortunate effect of
making them practically unreviewable in Phabricator since it will only display
the separate versions of the file in other views, not a diff. phabreading
such submissions are similar, since it will just output the binary patch, but
hg import copes with it fine and hg diff afterwards will show the actual
changes. It is still a marked improvement over trying to submit them as text,
which just leads to corruption (Phabricator will either output ? or HTML
entities for non-UTF-8 characters, depending on context).

Running decode on the whole file like this seems slightly unfortunate, but I'm
not aware of a better way.
Needs to be done to p1() version as well to detect conversions to UTF-8.

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

Kwan created this revision.Oct 10 2019, 5:53 PM
Kwan updated this revision to Diff 17084.Oct 11 2019, 1:55 PM

Fix some test-check-code issues, and one test-check-pyflakes unused local.

Kwan updated this revision to Diff 17104.Oct 12 2019, 9:45 AM

I'd missed out the attrs key conversion needed on py3.

This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.