changeset 50880:ee393dbfe5cb

largefiles: migrate `opts` to native kwargs
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 20 Aug 2023 16:51:49 -0400
parents 7e6cd8472dc8
children 4803cea1e5ab
files hgext/largefiles/lfcommands.py hgext/largefiles/overrides.py
diffstat 2 files changed, 6 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/lfcommands.py	Sun Aug 20 16:43:41 2023 -0400
+++ b/hgext/largefiles/lfcommands.py	Sun Aug 20 16:51:49 2023 -0400
@@ -27,7 +27,6 @@
     lock,
     logcmdutil,
     match as matchmod,
-    pycompat,
     scmutil,
     util,
 )
@@ -87,12 +86,11 @@
     Use --to-normal to convert largefiles back to normal files; after
     this, the DEST repository can be used without largefiles at all."""
 
-    opts = pycompat.byteskwargs(opts)
-    if opts[b'to_normal']:
+    if opts['to_normal']:
         tolfile = False
     else:
         tolfile = True
-        size = lfutil.getminsize(ui, True, opts.get(b'size'), default=None)
+        size = lfutil.getminsize(ui, True, opts.get('size'), default=None)
 
     if not hg.islocal(src):
         raise error.Abort(_(b'%s is not a local Mercurial repo') % src)
--- a/hgext/largefiles/overrides.py	Sun Aug 20 16:43:41 2023 -0400
+++ b/hgext/largefiles/overrides.py	Sun Aug 20 16:51:49 2023 -0400
@@ -1717,11 +1717,10 @@
 
 @eh.wrapcommand(b'cat')
 def overridecat(orig, ui, repo, file1, *pats, **opts):
-    opts = pycompat.byteskwargs(opts)
-    ctx = logcmdutil.revsingle(repo, opts.get(b'rev'))
+    ctx = logcmdutil.revsingle(repo, opts.get('rev'))
     err = 1
     notbad = set()
-    m = scmutil.match(ctx, (file1,) + pats, opts)
+    m = scmutil.match(ctx, (file1,) + pats, pycompat.byteskwargs(opts))
     origmatchfn = m.matchfn
 
     def lfmatchfn(f):
@@ -1758,12 +1757,12 @@
     m.visitdir = lfvisitdirfn
 
     for f in ctx.walk(m):
-        with cmdutil.makefileobj(ctx, opts.get(b'output'), pathname=f) as fp:
+        with cmdutil.makefileobj(ctx, opts.get('output'), pathname=f) as fp:
             lf = lfutil.splitstandin(f)
             if lf is None or origmatchfn(f):
                 # duplicating unreachable code from commands.cat
                 data = ctx[f].data()
-                if opts.get(b'decode'):
+                if opts.get('decode'):
                     data = repo.wwritedata(f, data)
                 fp.write(data)
             else: