Patchwork D6295: phabricator: use templatefilters.json in writediffproperties

login
register
mail settings
Submitter phabricator
Date April 22, 2019, 6:24 p.m.
Message ID <e7227b2fd6d13cd37ba831bd80663c39@localhost.localdomain>
Download mbox | patch
Permalink /patch/39802/
State Not Applicable
Headers show

Comments

phabricator - April 22, 2019, 6:24 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG289d82a070e9: phabricator: use templatefilters.json in writediffproperties (authored by Kwan, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6295?vs=14881&id=14896

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

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS




To: Kwan, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -65,6 +65,7 @@ 
     scmutil,
     smartset,
     tags,
+    templatefilters,
     templateutil,
     url as urlmod,
     util,
@@ -380,24 +381,23 @@ 
     params = {
         b'diff_id': diff[b'id'],
         b'name': b'hg:meta',
-        b'data': json.dumps({
-            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()),
+        b'data': templatefilters.json({
+            b'user': ctx.user(),
+            b'date': b'%d %d' % ctx.date(),
+            b'node': ctx.hex(),
+            b'parent': ctx.p1().hex(),
         }),
     }
     callconduit(ctx.repo(), b'differential.setdiffproperty', params)
 
     params = {
         b'diff_id': diff[b'id'],
         b'name': b'local:commits',
-        b'data': json.dumps({
-            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]),
+        b'data': templatefilters.json({
+            ctx.hex(): {
+                b'author': stringutil.person(ctx.user()),
+                b'authorEmail': stringutil.email(ctx.user()),
+                b'time': b'%d' % ctx.date()[0],
             },
         }),
     }