# HG changeset patch # User Matt Harbison # Date 1692654061 14400 # Node ID 36f116820853e5d37dc6167e4481134f0a6b17cf # Parent 98d1117dc904b3cca823ebc7c2dafc2639049456 debugserve: migrate `opts` to native kwargs diff -r 98d1117dc904 -r 36f116820853 mercurial/debugcommands.py --- a/mercurial/debugcommands.py Mon Aug 21 17:39:22 2023 -0400 +++ b/mercurial/debugcommands.py Mon Aug 21 17:41:01 2023 -0400 @@ -3490,30 +3490,28 @@ workaround to the fact that ``hg serve --stdio`` must have specific arguments for security reasons. """ - opts = pycompat.byteskwargs(opts) - - if not opts[b'sshstdio']: + if not opts['sshstdio']: raise error.Abort(_(b'only --sshstdio is currently supported')) logfh = None - if opts[b'logiofd'] and opts[b'logiofile']: + if opts['logiofd'] and opts['logiofile']: raise error.Abort(_(b'cannot use both --logiofd and --logiofile')) - if opts[b'logiofd']: + if opts['logiofd']: # Ideally we would be line buffered. But line buffering in binary # mode isn't supported and emits a warning in Python 3.8+. Disabling # buffering could have performance impacts. But since this isn't # performance critical code, it should be fine. try: - logfh = os.fdopen(int(opts[b'logiofd']), 'ab', 0) + logfh = os.fdopen(int(opts['logiofd']), 'ab', 0) except OSError as e: if e.errno != errno.ESPIPE: raise # can't seek a pipe, so `ab` mode fails on py3 - logfh = os.fdopen(int(opts[b'logiofd']), 'wb', 0) - elif opts[b'logiofile']: - logfh = open(opts[b'logiofile'], b'ab', 0) + logfh = os.fdopen(int(opts['logiofd']), 'wb', 0) + elif opts['logiofile']: + logfh = open(opts['logiofile'], b'ab', 0) s = wireprotoserver.sshserver(ui, repo, logfh=logfh) s.serve_forever()