phabricator: change conduit data format to match arcanist
authorIan Moody <moz-ian@perix.co.uk>
Sun, 06 Oct 2019 18:21:01 +0100
changeset 43261 f5aa4a53acd1
parent 43260 ec4dfcc39638
child 43262 af067d29b19e
phabricator: change conduit data format to match arcanist The existing form isn't handled well by Phabricator for certain data types. Differential Revision: https://phab.mercurial-scm.org/D7052
hgext/phabricator.py
--- a/hgext/phabricator.py	Thu Oct 10 18:44:58 2019 +0100
+++ b/hgext/phabricator.py	Sun Oct 06 18:21:01 2019 +0100
@@ -267,8 +267,15 @@
     url, authinfo = util.url(b'/'.join([host, b'api', name])).authinfo()
     ui.debug(b'Conduit Call: %s %s\n' % (url, pycompat.byterepr(params)))
     params = params.copy()
-    params[b'api.token'] = token
-    data = urlencodenested(params)
+    params[b'__conduit__'] = {
+        b'token': token,
+    }
+    rawdata = {
+        b'params': templatefilters.json(params),
+        b'output': b'json',
+        b'__conduit__': 1,
+    }
+    data = urlencodenested(rawdata)
     curlcmd = ui.config(b'phabricator', b'curlcmd')
     if curlcmd:
         sin, sout = procutil.popen2(