Mercurial > public > mercurial-scm > hg
comparison hgext/phabricator.py @ 43261:f5aa4a53acd1
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
author | Ian Moody <moz-ian@perix.co.uk> |
---|---|
date | Sun, 06 Oct 2019 18:21:01 +0100 |
parents | 162b81e65e60 |
children | af067d29b19e |
comparison
equal
deleted
inserted
replaced
43260:ec4dfcc39638 | 43261:f5aa4a53acd1 |
---|---|
265 """call Conduit API, params is a dict. return json.loads result, or None""" | 265 """call Conduit API, params is a dict. return json.loads result, or None""" |
266 host, token = readurltoken(ui) | 266 host, token = readurltoken(ui) |
267 url, authinfo = util.url(b'/'.join([host, b'api', name])).authinfo() | 267 url, authinfo = util.url(b'/'.join([host, b'api', name])).authinfo() |
268 ui.debug(b'Conduit Call: %s %s\n' % (url, pycompat.byterepr(params))) | 268 ui.debug(b'Conduit Call: %s %s\n' % (url, pycompat.byterepr(params))) |
269 params = params.copy() | 269 params = params.copy() |
270 params[b'api.token'] = token | 270 params[b'__conduit__'] = { |
271 data = urlencodenested(params) | 271 b'token': token, |
272 } | |
273 rawdata = { | |
274 b'params': templatefilters.json(params), | |
275 b'output': b'json', | |
276 b'__conduit__': 1, | |
277 } | |
278 data = urlencodenested(rawdata) | |
272 curlcmd = ui.config(b'phabricator', b'curlcmd') | 279 curlcmd = ui.config(b'phabricator', b'curlcmd') |
273 if curlcmd: | 280 if curlcmd: |
274 sin, sout = procutil.popen2( | 281 sin, sout = procutil.popen2( |
275 b'%s -d @- %s' % (curlcmd, procutil.shellquote(url)) | 282 b'%s -d @- %s' % (curlcmd, procutil.shellquote(url)) |
276 ) | 283 ) |