Patchwork D192: phabricator: convert unicode to binary when writing patches

login
register
mail settings
Submitter phabricator
Date July 27, 2017, 7:51 p.m.
Message ID <differential-rev-PHID-DREV-6p2nb3e2kqbfhx36lszn-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/22567/
State Superseded, archived
Headers show

Comments

phabricator - July 27, 2017, 7:51 p.m.
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D192

AFFECTED FILES
  contrib/phabricator.py

CHANGE DETAILS




To: quark, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/contrib/phabricator.py b/contrib/phabricator.py
--- a/contrib/phabricator.py
+++ b/contrib/phabricator.py
@@ -560,7 +560,8 @@ 
             if k in meta:
                 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',
          [('', 'stack', False, _('read dependencies'))],