archive: migrate `opts` to native kwargs
authorMatt Harbison <matt_harbison@yahoo.com>
Sun, 20 Aug 2023 00:35:28 -0400
changeset 50826 36901c182d70
parent 50825 973fbb27ab45
child 50827 aad6e62d64f8
archive: migrate `opts` to native kwargs I'm not sure how to handle migrating core APIs like `scmutil.match`, so kick that can down the road. (Plus it's used all over, so the callers need to be migrated first.)
mercurial/commands.py
--- a/mercurial/commands.py	Sun Aug 20 00:27:27 2023 -0400
+++ b/mercurial/commands.py	Sun Aug 20 00:35:28 2023 -0400
@@ -646,8 +646,7 @@
     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)
@@ -660,8 +659,8 @@
     if os.path.realpath(dest) == repo.root:
         raise error.InputError(_(b'repository root cannot be destination'))
 
-    kind = opts.get(b'type') or archival.guesskind(dest) or b'files'
-    prefix = opts.get(b'prefix')
+    kind = opts.get('type') or archival.guesskind(dest) or b'files'
+    prefix = opts.get('prefix')
 
     if dest == b'-':
         if kind == b'files':
@@ -671,16 +670,16 @@
             prefix = os.path.basename(repo.root) + b'-%h'
 
     prefix = cmdutil.makefilename(ctx, prefix)
-    match = scmutil.match(ctx, [], opts)
+    match = scmutil.match(ctx, [], pycompat.byteskwargs(opts))
     archival.archive(
         repo,
         dest,
         node,
         kind,
-        not opts.get(b'no_decode'),
+        not opts.get('no_decode'),
         match,
         prefix,
-        subrepos=opts.get(b'subrepos'),
+        subrepos=opts.get('subrepos'),
     )