cmdutil: migrate `opts` on commitstatus() to native kwargs
authorMatt Harbison <matt_harbison@yahoo.com>
Sat, 19 Aug 2023 23:06:40 -0400
changeset 50824 489268c8ee7e
parent 50823 b922c767b214
child 50825 973fbb27ab45
cmdutil: migrate `opts` on commitstatus() to native kwargs
mercurial/cmdutil.py
mercurial/commands.py
--- a/mercurial/cmdutil.py	Sat Aug 19 22:56:14 2023 -0400
+++ b/mercurial/cmdutil.py	Sat Aug 19 23:06:40 2023 -0400
@@ -3329,9 +3329,7 @@
     return b"\n".join(edittext)
 
 
-def commitstatus(repo, node, branch, bheads=None, tip=None, opts=None):
-    if opts is None:
-        opts = {}
+def commitstatus(repo, node, branch, bheads=None, tip=None, **opts):
     ctx = repo[node]
     parents = ctx.parents()
 
@@ -3341,7 +3339,7 @@
         # for most instances
         repo.ui.warn(_(b"warning: commit already existed in the repository!\n"))
     elif (
-        not opts.get(b'amend')
+        not opts.get('amend')
         and bheads
         and node not in bheads
         and not any(
@@ -3378,7 +3376,7 @@
         #
         # H H  n  head merge: head count decreases
 
-    if not opts.get(b'close_branch'):
+    if not opts.get('close_branch'):
         for r in parents:
             if r.closesbranch() and r.branch() == branch:
                 repo.ui.status(
--- a/mercurial/commands.py	Sat Aug 19 22:56:14 2023 -0400
+++ b/mercurial/commands.py	Sat Aug 19 23:06:40 2023 -0400
@@ -2175,7 +2175,6 @@
             cmdutil.checkunfinished(repo)
 
         node = cmdutil.amend(ui, repo, old, extra, pats, opts)
-        opts = pycompat.byteskwargs(opts)
         if node == old.node():
             ui.status(_(b"nothing changed\n"))
             return 1
@@ -2206,11 +2205,14 @@
                         extra=extra,
                     )
 
-        opts = pycompat.byteskwargs(opts)
-        node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
+        node = cmdutil.commit(
+            ui, repo, commitfunc, pats, pycompat.byteskwargs(opts)
+        )
 
         if not node:
-            stat = cmdutil.postcommitstatus(repo, pats, opts)
+            stat = cmdutil.postcommitstatus(
+                repo, pats, pycompat.byteskwargs(opts)
+            )
             if stat.deleted:
                 ui.status(
                     _(
@@ -2223,7 +2225,7 @@
                 ui.status(_(b"nothing changed\n"))
             return 1
 
-    cmdutil.commitstatus(repo, node, branch, bheads, tip, opts)
+    cmdutil.commitstatus(repo, node, branch, bheads, tip, **opts)
 
     if not ui.quiet and ui.configbool(b'commands', b'commit.post-status'):
         status(
@@ -2234,7 +2236,7 @@
             removed=True,
             deleted=True,
             unknown=True,
-            subrepos=opts.get(b'subrepos'),
+            subrepos=opts.get('subrepos'),
         )