cat: avoid round tripping **opts -> byteskwargs -> strkwargs
authorMatt Harbison <matt_harbison@yahoo.com>
Sat, 19 Aug 2023 22:56:14 -0400
changeset 50847 b922c767b214
parent 50846 3ccef7902070
child 50848 489268c8ee7e
cat: avoid round tripping **opts -> byteskwargs -> strkwargs Some internal users still want byteskwargs, so they are serviced in place. Once this pattern of changing types is eliminated everywhere, the remaining internal uses can be cleaned up individually (hopefully).
mercurial/commands.py
--- a/mercurial/commands.py	Mon Aug 07 11:08:00 2023 +0200
+++ b/mercurial/commands.py	Sat Aug 19 22:56:14 2023 -0400
@@ -1794,25 +1794,22 @@
 
     Returns 0 on success.
     """
-    opts = pycompat.byteskwargs(opts)
-    rev = opts.get(b'rev')
+    rev = opts.get('rev')
     if rev:
         repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn')
     ctx = logcmdutil.revsingle(repo, rev)
-    m = scmutil.match(ctx, (file1,) + pats, opts)
-    fntemplate = opts.pop(b'output', b'')
+    m = scmutil.match(ctx, (file1,) + pats, pycompat.byteskwargs(opts))
+    fntemplate = opts.pop('output', b'')
     if cmdutil.isstdiofilename(fntemplate):
         fntemplate = b''
 
     if fntemplate:
-        fm = formatter.nullformatter(ui, b'cat', opts)
+        fm = formatter.nullformatter(ui, b'cat', pycompat.byteskwargs(opts))
     else:
         ui.pager(b'cat')
-        fm = ui.formatter(b'cat', opts)
+        fm = ui.formatter(b'cat', pycompat.byteskwargs(opts))
     with fm:
-        return cmdutil.cat(
-            ui, repo, ctx, m, fm, fntemplate, b'', **pycompat.strkwargs(opts)
-        )
+        return cmdutil.cat(ui, repo, ctx, m, fm, fntemplate, b'', **opts)
 
 
 @command(