[PATCH STABLE] phabricator: convert unicode to binary when writing patches

Jun Wu quark at fb.com
Thu Jul 27 19:03:41 UTC 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1501182181 25200
#      Thu Jul 27 12:03:01 2017 -0700
# Branch stable
# Node ID e3b08c0b6d7ca92f0d8b741585338b68ed0d8c48
# Parent  c5607b65fcb8cf5b789c49a8cf4fecfe83931727
phabricator: convert unicode to binary when writing patches

This is a quick fix to make `hg phabread D189` work.

It seems we might want to replace all `r''` to `u''`, and add more
`encoding.*to*` to be more explicit when interacting with `json` module.

diff --git a/contrib/phabricator.py b/contrib/phabricator.py
--- a/contrib/phabricator.py
+++ b/contrib/phabricator.py
@@ -561,5 +561,6 @@ def readpatch(repo, params, write, stack
                 header += '# %s %s\n' % (_metanamemap[k], meta[k])
 
-        write(('%s%s\n%s') % (header, desc, body))
+        content = '%s%s\n%s' % (header, desc, body)
+        write(encoding.unitolocal(content))
 
 @command('phabread',


More information about the Mercurial-devel mailing list