jp: jp asyncio port:

/!\ this commit is huge. Jp is temporarily not working with `dbus` bridge /!\

This patch implements the port of jp to asyncio, so it is now correctly using the bridge
asynchronously, and it can be used with bridges like `pb`. This also simplify the code,
notably for things which were previously implemented with many callbacks (like pagination
with RSM).

During the process, some behaviours have been modified/fixed, in jp and backends, check
diff for details.
This commit is contained in:
Goffi 2019-09-25 08:56:41 +02:00
commit 76aadbb3fb

View file

@ -53,6 +53,7 @@ class MercurialProtocol(async_process.CommandProtocol):
@param path(unicode): path to the repository
@param command(unicode): hg command to run
@return D(bytes): stdout of the command
"""
assert "path" not in kwargs
kwargs["path"] = path
@ -86,8 +87,10 @@ class MercurialHandler(object):
return d
def export(self, repository):
return MercurialProtocol.run(repository, 'export', '-g', '-r', 'outgoing()',
'--encoding=utf-8')
d = MercurialProtocol.run(repository, 'export', '-g', '-r', 'outgoing()',
'--encoding=utf-8')
d.addCallback(lambda data: data.decode('utf-8'))
return d
def import_(self, repository, data, data_type, item_id, service, node, extra):
parsed_data = self.parse(data)
@ -97,7 +100,7 @@ class MercurialHandler(object):
except Exception:
parsed_name = ''
name = 'mr_{item_id}_{parsed_name}'.format(item_id=CLEAN_RE.sub('', item_id),
parsed_name=parsed_name)
parsed_name=parsed_name)
return MercurialProtocol.run(repository, 'qimport', '-g', '--name', name,
'--encoding=utf-8', '-', stdin=data)