# HG changeset patch # User Matt Harbison # Date 1692509069 14400 # Node ID 2bbc76528733892c395963daed0c018dd7a37ec1 # Parent 07c6a085fad724a14188cbd6a29b3ff95a882e24 import: migrate `opts` to native kwargs diff -r 07c6a085fad7 -r 2bbc76528733 mercurial/commands.py --- a/mercurial/commands.py Sun Aug 20 01:20:59 2023 -0400 +++ b/mercurial/commands.py Sun Aug 20 01:24:29 2023 -0400 @@ -4210,20 +4210,20 @@ opts, 'no_commit', ['bypass', 'secret'] ) cmdutil.check_incompatible_arguments(opts, 'exact', ['edit', 'prefix']) - opts = pycompat.byteskwargs(opts) + if not patch1: raise error.InputError(_(b'need at least one patch to import')) patches = (patch1,) + patches - date = opts.get(b'date') + date = opts.get('date') if date: - opts[b'date'] = dateutil.parsedate(date) - - exact = opts.get(b'exact') - update = not opts.get(b'bypass') + opts['date'] = dateutil.parsedate(date) + + exact = opts.get('exact') + update = not opts.get('bypass') try: - sim = float(opts.get(b'similarity') or 0) + sim = float(opts.get('similarity') or 0) except ValueError: raise error.InputError(_(b'similarity must be a number')) if sim < 0 or sim > 100: @@ -4231,17 +4231,17 @@ if sim and not update: raise error.InputError(_(b'cannot use --similarity with --bypass')) - base = opts[b"base"] + base = opts["base"] msgs = [] ret = 0 with repo.wlock(): if update: cmdutil.checkunfinished(repo) - if exact or not opts.get(b'force'): + if exact or not opts.get('force'): cmdutil.bailifchanged(repo) - if not opts.get(b'no_commit'): + if not opts.get('no_commit'): lock = repo.lock tr = lambda: repo.transaction(b'import') else: @@ -4263,7 +4263,13 @@ for hunk in patch.split(patchfile): with patch.extract(ui, hunk) as patchdata: msg, node, rej = cmdutil.tryimportone( - ui, repo, patchdata, parents, opts, msgs, hg.clean + ui, + repo, + patchdata, + parents, + pycompat.byteskwargs(opts), + msgs, + hg.clean, ) if msg: haspatch = True