py3: only pass unicode to json.dumps in writediffproperties
Differential Revision: https://phab.mercurial-scm.org/D6109
--- a/hgext/phabricator.py Sat Mar 09 01:30:44 2019 +0000
+++ b/hgext/phabricator.py Sat Mar 09 01:53:53 2019 +0000
@@ -371,10 +371,10 @@
b'diff_id': diff[b'id'],
b'name': b'hg:meta',
b'data': json.dumps({
- b'user': ctx.user(),
- b'date': b'%d %d' % ctx.date(),
- b'node': ctx.hex(),
- b'parent': ctx.p1().hex(),
+ u'user': encoding.unifromlocal(ctx.user()),
+ u'date': u'{:.0f} {}'.format(*ctx.date()),
+ u'node': encoding.unifromlocal(ctx.hex()),
+ u'parent': encoding.unifromlocal(ctx.p1().hex()),
}),
}
callconduit(ctx.repo(), b'differential.setdiffproperty', params)
@@ -383,10 +383,11 @@
b'diff_id': diff[b'id'],
b'name': b'local:commits',
b'data': json.dumps({
- ctx.hex(): {
- b'author': stringutil.person(ctx.user()),
- b'authorEmail': stringutil.email(ctx.user()),
- b'time': ctx.date()[0],
+ encoding.unifromlocal(ctx.hex()): {
+ u'author': encoding.unifromlocal(stringutil.person(ctx.user())),
+ u'authorEmail': encoding.unifromlocal(
+ stringutil.email(ctx.user())),
+ u'time': u'{:.0f}'.format(ctx.date()[0]),
},
}),
}