Mercurial > hg-stable
changeset 38699:72c086b1af12
py3: byte-stringify literals in extension in test-bundle2-remote-changegroup.t
# skip-blame just some b''
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 08 Jul 2018 19:39:11 +0900 |
parents | 6437e89b64d5 |
children | cfdf7bfb0ac0 |
files | tests/test-bundle2-remote-changegroup.t |
diffstat | 1 files changed, 18 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-bundle2-remote-changegroup.t Sun Jul 08 19:41:00 2018 +0900 +++ b/tests/test-bundle2-remote-changegroup.t Sun Jul 08 19:39:11 2018 +0900 @@ -40,45 +40,45 @@ > Python expression as parameters. The Python expression is > evaluated with eval, and is expected to be a dict. > """ - > def newpart(name, data=''): + > def newpart(name, data=b''): > """wrapper around bundler.newpart adding an extra part making the > client output information about each processed part""" - > bundler.newpart('output', data=name) + > bundler.newpart(b'output', data=name) > part = bundler.newpart(name, data=data) > return part > - > for line in open(repo.vfs.join('bundle2maker'), 'rb'): + > for line in open(repo.vfs.join(b'bundle2maker'), 'rb'): > line = line.strip() > try: > verb, args = line.split(None, 1) > except ValueError: - > verb, args = line, '' - > if verb == 'remote-changegroup': + > verb, args = line, b'' + > if verb == b'remote-changegroup': > url, file = args.split() > bundledata = open(file, 'rb').read() - > digest = util.digester.preferred(b2caps['digests']) + > digest = util.digester.preferred(b2caps[b'digests']) > d = util.digester([digest], bundledata) - > part = newpart('remote-changegroup') - > part.addparam('url', url) - > part.addparam('size', str(len(bundledata))) - > part.addparam('digests', digest) - > part.addparam('digest:%s' % digest, d[digest]) - > elif verb == 'raw-remote-changegroup': - > part = newpart('remote-changegroup') + > part = newpart(b'remote-changegroup') + > part.addparam(b'url', url) + > part.addparam(b'size', str(len(bundledata))) + > part.addparam(b'digests', digest) + > part.addparam(b'digest:%s' % digest, d[digest]) + > elif verb == b'raw-remote-changegroup': + > part = newpart(b'remote-changegroup') > for k, v in eval(args).items(): > part.addparam(k, str(v)) - > elif verb == 'changegroup': + > elif verb == b'changegroup': > _common, heads = args.split() > common.extend(repo[r].node() for r in repo.revs(_common)) > heads = [repo[r].node() for r in repo.revs(heads)] > outgoing = discovery.outgoing(repo, common, heads) - > cg = changegroup.makechangegroup(repo, outgoing, '01', - > 'changegroup') - > newpart('changegroup', cg.getchunks()) + > cg = changegroup.makechangegroup(repo, outgoing, b'01', + > b'changegroup') + > newpart(b'changegroup', cg.getchunks()) > else: > raise Exception('unknown verb') > - > exchange.getbundle2partsmapping['changegroup'] = _getbundlechangegrouppart + > exchange.getbundle2partsmapping[b'changegroup'] = _getbundlechangegrouppart > EOF Start a simple HTTP server to serve bundles