keyword: migrate `opts` to native kwargs
authorMatt Harbison <matt_harbison@yahoo.com>
Sun, 20 Aug 2023 16:43:41 -0400
changeset 50879 7e6cd8472dc8
parent 50878 bbaac3a222bb
child 50880 ee393dbfe5cb
keyword: migrate `opts` to native kwargs
hgext/keyword.py
--- a/hgext/keyword.py	Sun Aug 20 16:20:56 2023 -0400
+++ b/hgext/keyword.py	Sun Aug 20 16:43:41 2023 -0400
@@ -420,11 +420,10 @@
     """Bails out if [keyword] configuration is not active.
     Returns status of working directory."""
     if kwt:
-        opts = pycompat.byteskwargs(opts)
         return repo.status(
-            match=scmutil.match(wctx, pats, opts),
+            match=scmutil.match(wctx, pats, pycompat.byteskwargs(opts)),
             clean=True,
-            unknown=opts.get(b'unknown') or opts.get(b'all'),
+            unknown=opts.get('unknown') or opts.get('all'),
         )
     if ui.configitems(b'keyword'):
         raise error.Abort(_(b'[keyword] patterns cannot match'))
@@ -604,26 +603,26 @@
     else:
         cwd = b''
     files = []
-    opts = pycompat.byteskwargs(opts)
-    if not opts.get(b'unknown') or opts.get(b'all'):
+
+    if not opts.get('unknown') or opts.get('all'):
         files = sorted(status.modified + status.added + status.clean)
     kwfiles = kwt.iskwfile(files, wctx)
     kwdeleted = kwt.iskwfile(status.deleted, wctx)
     kwunknown = kwt.iskwfile(status.unknown, wctx)
-    if not opts.get(b'ignore') or opts.get(b'all'):
+    if not opts.get('ignore') or opts.get('all'):
         showfiles = kwfiles, kwdeleted, kwunknown
     else:
         showfiles = [], [], []
-    if opts.get(b'all') or opts.get(b'ignore'):
+    if opts.get('all') or opts.get('ignore'):
         showfiles += (
             [f for f in files if f not in kwfiles],
             [f for f in status.unknown if f not in kwunknown],
         )
     kwlabels = b'enabled deleted enabledunknown ignored ignoredunknown'.split()
     kwstates = zip(kwlabels, pycompat.bytestr(b'K!kIi'), showfiles)
-    fm = ui.formatter(b'kwfiles', opts)
+    fm = ui.formatter(b'kwfiles', pycompat.byteskwargs(opts))
     fmt = b'%.0s%s\n'
-    if opts.get(b'all') or ui.verbose:
+    if opts.get('all') or ui.verbose:
         fmt = b'%s %s\n'
     for kwstate, char, filenames in kwstates:
         label = b'kwfiles.' + kwstate