Show More
@@ -240,10 +240,20 b' def debugcallconduit(ui, repo, name):' | |||||
240 | Call parameters are read from stdin as a JSON blob. Result will be written |
|
240 | Call parameters are read from stdin as a JSON blob. Result will be written | |
241 | to stdout as a JSON blob. |
|
241 | to stdout as a JSON blob. | |
242 | """ |
|
242 | """ | |
243 | params = json.loads(ui.fin.read()) |
|
243 | # json.loads only accepts bytes from 3.6+ | |
244 | result = callconduit(repo, name, params) |
|
244 | rawparams = encoding.unifromlocal(ui.fin.read()) | |
245 | s = json.dumps(result, sort_keys=True, indent=2, separators=(b',', b': ')) |
|
245 | # json.loads only returns unicode strings | |
246 | ui.write(b'%s\n' % s) |
|
246 | params = pycompat.rapply(lambda x: | |
|
247 | encoding.unitolocal(x) if isinstance(x, pycompat.unicode) else x, | |||
|
248 | json.loads(rawparams) | |||
|
249 | ) | |||
|
250 | # json.dumps only accepts unicode strings | |||
|
251 | result = pycompat.rapply(lambda x: | |||
|
252 | encoding.unifromlocal(x) if isinstance(x, bytes) else x, | |||
|
253 | callconduit(repo, name, params) | |||
|
254 | ) | |||
|
255 | s = json.dumps(result, sort_keys=True, indent=2, separators=(u',', u': ')) | |||
|
256 | ui.write(b'%s\n' % encoding.unitolocal(s)) | |||
247 |
|
257 | |||
248 | def getrepophid(repo): |
|
258 | def getrepophid(repo): | |
249 | """given callsign, return repository PHID or None""" |
|
259 | """given callsign, return repository PHID or None""" |
General Comments 0
You need to be logged in to leave comments.
Login now