Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG9a8c7c17d816: py3: don't try and format a bare dict into a byte string in callconduit
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
% (url,)) | % (url,)) | ||||
return url, token | return url, token | ||||
def callconduit(repo, name, params): | def callconduit(repo, name, params): | ||||
"""call Conduit API, params is a dict. return json.loads result, or None""" | """call Conduit API, params is a dict. return json.loads result, or None""" | ||||
host, token = readurltoken(repo) | host, token = readurltoken(repo) | ||||
url, authinfo = util.url(b'/'.join([host, b'api', name])).authinfo() | url, authinfo = util.url(b'/'.join([host, b'api', name])).authinfo() | ||||
repo.ui.debug(b'Conduit Call: %s %s\n' % (url, params)) | repo.ui.debug(b'Conduit Call: %s %s\n' % (url, pycompat.byterepr(params))) | ||||
params = params.copy() | params = params.copy() | ||||
params[b'api.token'] = token | params[b'api.token'] = token | ||||
data = urlencodenested(params) | data = urlencodenested(params) | ||||
curlcmd = repo.ui.config(b'phabricator', b'curlcmd') | curlcmd = repo.ui.config(b'phabricator', b'curlcmd') | ||||
if curlcmd: | if curlcmd: | ||||
sin, sout = procutil.popen2(b'%s -d @- %s' | sin, sout = procutil.popen2(b'%s -d @- %s' | ||||
% (curlcmd, procutil.shellquote(url))) | % (curlcmd, procutil.shellquote(url))) | ||||
sin.write(data) | sin.write(data) |