summary: migrate `opts` to native kwargs
authorMatt Harbison <matt_harbison@yahoo.com>
Sun, 20 Aug 2023 02:10:51 -0400
changeset 50850 65e2cb23294e
parent 50849 fdf97ae05165
child 50851 fa675fd648a3
summary: migrate `opts` to native kwargs This has the added benefit of unconfusing PyCharm- it thought `opts` in the nested functions were str based for some reason.
mercurial/commands.py
--- a/mercurial/commands.py	Sun Aug 20 02:01:37 2023 -0400
+++ b/mercurial/commands.py	Sun Aug 20 02:10:51 2023 -0400
@@ -7115,7 +7115,6 @@
     Returns 0 on success.
     """
 
-    opts = pycompat.byteskwargs(opts)
     ui.pager(b'summary')
     ctx = repo[None]
     parents = ctx.parents()
@@ -7304,11 +7303,13 @@
 
     cmdutil.summaryhooks(ui, repo)
 
-    if opts.get(b'remote'):
+    if opts.get('remote'):
         needsincoming, needsoutgoing = True, True
     else:
         needsincoming, needsoutgoing = False, False
-        for i, o in cmdutil.summaryremotehooks(ui, repo, opts, None):
+        for i, o in cmdutil.summaryremotehooks(
+            ui, repo, pycompat.byteskwargs(opts), None
+        ):
             if i:
                 needsincoming = True
             if o:
@@ -7325,7 +7326,7 @@
         try:
             other = hg.peer(repo, {}, path)
         except error.RepoError:
-            if opts.get(b'remote'):
+            if opts.get('remote'):
                 raise
             return path.loc, sbranch, None, None, None
         branches = (path.branch, [])
@@ -7364,7 +7365,7 @@
             try:
                 dother = hg.peer(repo, {}, path if path is not None else dest)
             except error.RepoError:
-                if opts.get(b'remote'):
+                if opts.get('remote'):
                     raise
                 return dest, dbranch, None, None
             ui.debug(b'comparing with %s\n' % urlutil.hidepassword(dest))
@@ -7390,7 +7391,7 @@
     else:
         dest = dbranch = dother = outgoing = None
 
-    if opts.get(b'remote'):
+    if opts.get('remote'):
         # Help pytype.  --remote sets both `needsincoming` and `needsoutgoing`.
         # The former always sets `sother` (or raises an exception if it can't);
         # the latter always sets `outgoing`.
@@ -7421,7 +7422,7 @@
     cmdutil.summaryremotehooks(
         ui,
         repo,
-        opts,
+        pycompat.byteskwargs(opts),
         (
             (source, sbranch, sother, commoninc),
             (dest, dbranch, dother, outgoing),