##// END OF EJS Templates
debugwireproto: migrate `opts` to native kwargs
Matt Harbison -
r51866:fd6c748e default
parent child Browse files
Show More
@@ -4483,12 +4483,10 b' def debugwireproto(ui, repo, path=None, '
4483 4483 resulting object is fed into a CBOR encoder. Otherwise it is interpreted
4484 4484 as a Python byte string literal.
4485 4485 """
4486 opts = pycompat.byteskwargs(opts)
4487
4488 if opts[b'localssh'] and not repo:
4486 if opts['localssh'] and not repo:
4489 4487 raise error.Abort(_(b'--localssh requires a repository'))
4490 4488
4491 if opts[b'peer'] and opts[b'peer'] not in (
4489 if opts['peer'] and opts['peer'] not in (
4492 4490 b'raw',
4493 4491 b'ssh1',
4494 4492 ):
@@ -4497,7 +4495,7 b' def debugwireproto(ui, repo, path=None, '
4497 4495 hint=_(b'valid values are "raw" and "ssh1"'),
4498 4496 )
4499 4497
4500 if path and opts[b'localssh']:
4498 if path and opts['localssh']:
4501 4499 raise error.Abort(_(b'cannot specify --localssh with an explicit path'))
4502 4500
4503 4501 if ui.interactive():
@@ -4511,7 +4509,7 b' def debugwireproto(ui, repo, path=None, '
4511 4509 stderr = None
4512 4510 opener = None
4513 4511
4514 if opts[b'localssh']:
4512 if opts['localssh']:
4515 4513 # We start the SSH server in its own process so there is process
4516 4514 # separation. This prevents a whole class of potential bugs around
4517 4515 # shared state from interfering with server operation.
@@ -4534,7 +4532,7 b' def debugwireproto(ui, repo, path=None, '
4534 4532 stderr = proc.stderr
4535 4533
4536 4534 # We turn the pipes into observers so we can log I/O.
4537 if ui.verbose or opts[b'peer'] == b'raw':
4535 if ui.verbose or opts['peer'] == b'raw':
4538 4536 stdin = util.makeloggingfileobject(
4539 4537 ui, proc.stdin, b'i', logdata=True
4540 4538 )
@@ -4548,9 +4546,9 b' def debugwireproto(ui, repo, path=None, '
4548 4546 # --localssh also implies the peer connection settings.
4549 4547
4550 4548 url = b'ssh://localserver'
4551 autoreadstderr = not opts[b'noreadstderr']
4552
4553 if opts[b'peer'] == b'ssh1':
4549 autoreadstderr = not opts['noreadstderr']
4550
4551 if opts['peer'] == b'ssh1':
4554 4552 ui.write(_(b'creating ssh peer for wire protocol version 1\n'))
4555 4553 peer = sshpeer.sshv1peer(
4556 4554 ui,
@@ -4562,7 +4560,7 b' def debugwireproto(ui, repo, path=None, '
4562 4560 None,
4563 4561 autoreadstderr=autoreadstderr,
4564 4562 )
4565 elif opts[b'peer'] == b'raw':
4563 elif opts['peer'] == b'raw':
4566 4564 ui.write(_(b'using raw connection to peer\n'))
4567 4565 peer = None
4568 4566 else:
@@ -4609,17 +4607,17 b' def debugwireproto(ui, repo, path=None, '
4609 4607 # Don't send default headers when in raw mode. This allows us to
4610 4608 # bypass most of the behavior of our URL handling code so we can
4611 4609 # have near complete control over what's sent on the wire.
4612 if opts[b'peer'] == b'raw':
4610 if opts['peer'] == b'raw':
4613 4611 openerargs['sendaccept'] = False
4614 4612
4615 4613 opener = urlmod.opener(ui, authinfo, **openerargs)
4616 4614
4617 if opts[b'peer'] == b'raw':
4615 if opts['peer'] == b'raw':
4618 4616 ui.write(_(b'using raw connection to peer\n'))
4619 4617 peer = None
4620 elif opts[b'peer']:
4618 elif opts['peer']:
4621 4619 raise error.Abort(
4622 _(b'--peer %s not supported with HTTP peers') % opts[b'peer']
4620 _(b'--peer %s not supported with HTTP peers') % opts['peer']
4623 4621 )
4624 4622 else:
4625 4623 peer_path = urlutil.try_path(ui, path)
General Comments 0
You need to be logged in to leave comments. Login now