comparison mercurial/debugcommands.py @ 50983:a4d21089bec7

debugwireargs: migrate `opts` to native kwargs
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 21 Aug 2023 17:54:01 -0400
parents e032f47f5166
children fd6c748eb8a6
comparison
equal deleted inserted replaced
50982:e032f47f5166 50983:a4d21089bec7
4217 + cmdutil.remoteopts, 4217 + cmdutil.remoteopts,
4218 _(b'REPO [OPTIONS]... [ONE [TWO]]'), 4218 _(b'REPO [OPTIONS]... [ONE [TWO]]'),
4219 norepo=True, 4219 norepo=True,
4220 ) 4220 )
4221 def debugwireargs(ui, repopath, *vals, **opts): 4221 def debugwireargs(ui, repopath, *vals, **opts):
4222 opts = pycompat.byteskwargs(opts) 4222 repo = hg.peer(ui, pycompat.byteskwargs(opts), repopath)
4223 repo = hg.peer(ui, opts, repopath)
4224 try: 4223 try:
4225 for opt in cmdutil.remoteopts: 4224 for opt in cmdutil.remoteopts:
4226 del opts[opt[1]] 4225 del opts[pycompat.sysstr(opt[1])]
4227 args = {} 4226 args = {}
4228 for k, v in opts.items(): 4227 for k, v in opts.items():
4229 if v: 4228 if v:
4230 args[k] = v 4229 args[k] = v
4231 args = pycompat.strkwargs(args) 4230
4232 # run twice to check that we don't mess up the stream for the next command 4231 # run twice to check that we don't mess up the stream for the next command
4233 res1 = repo.debugwireargs(*vals, **args) 4232 res1 = repo.debugwireargs(*vals, **args)
4234 res2 = repo.debugwireargs(*vals, **args) 4233 res2 = repo.debugwireargs(*vals, **args)
4235 ui.write(b"%s\n" % res1) 4234 ui.write(b"%s\n" % res1)
4236 if res1 != res2: 4235 if res1 != res2: