diff -r e032f47f5166 -r a4d21089bec7 mercurial/debugcommands.py --- a/mercurial/debugcommands.py Mon Aug 21 17:49:57 2023 -0400 +++ b/mercurial/debugcommands.py Mon Aug 21 17:54:01 2023 -0400 @@ -4219,16 +4219,15 @@ norepo=True, ) def debugwireargs(ui, repopath, *vals, **opts): - opts = pycompat.byteskwargs(opts) - repo = hg.peer(ui, opts, repopath) + repo = hg.peer(ui, pycompat.byteskwargs(opts), repopath) try: for opt in cmdutil.remoteopts: - del opts[opt[1]] + del opts[pycompat.sysstr(opt[1])] args = {} for k, v in opts.items(): if v: args[k] = v - args = pycompat.strkwargs(args) + # run twice to check that we don't mess up the stream for the next command res1 = repo.debugwireargs(*vals, **args) res2 = repo.debugwireargs(*vals, **args)