Closed Bug 1527765 Opened 5 years ago Closed 5 years ago

moz-phab patch breaks on unicode issues

Categories

(Conduit :: moz-phab, enhancement, P1)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: Gijs, Assigned: zalun)

Details

(Keywords: conduit-triaged)

Attachments

(1 file)

$ moz-phab patch --apply-to here --nobookmark D19312
Patching revision: D19312
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 5481: ordinal not in range(128)

Not sure how to get more details or work out why it's not working.

setting the DEBUG env var will increase the verbosity dramatically: $ DEBUG=1 moz-phab patch --apply-to here --nobookmark D19312

here's the stack:

ERROR    2019-02-14 12:01:40,165 Traceback (most recent call last):
  File "/Users/byron/bin/moz-phab", line 3152, in main
    args.func(repo, args)
  File "/Users/byron/bin/moz-phab", line 2904, in patch
    repo.apply_patch(raw, body, author, author_date)
  File "/Users/byron/bin/moz-phab", line 1046, in apply_patch
    with temporary_file(diff) as patch_file, temporary_file(body) as body_file:
  File "/usr/local/Cellar/python@2/2.7.15_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/Users/byron/bin/moz-phab", line 340, in temporary_file
    f.write(content)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 5481: ordinal not in range(128)

i suspect the fix is to encode the raw diff returned from the conduit call as utf-8 before passing it over to temporary_file.

Assignee: nobody → pzalewa
Priority: -- → P1
Keywords: conduit-triaged

A UnicodeEncodeError was raised on patching files. This patch encodes
the content before writing it to a temporary patch file.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: