changeset 50907:b5066b2b40f2

split: migrate `opts` to native kwargs
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 20 Aug 2023 17:16:38 -0400
parents 9ed17632ad83
children 2eca8b5c8cbd
files hgext/split.py
diffstat 1 files changed, 9 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/split.py	Sun Aug 20 17:09:33 2023 -0400
+++ b/hgext/split.py	Sun Aug 20 17:16:38 2023 -0400
@@ -22,7 +22,6 @@
     error,
     hg,
     logcmdutil,
-    pycompat,
     registrar,
     revsetlang,
     rewriteutil,
@@ -65,10 +64,9 @@
     By default, rebase connected non-obsoleted descendants onto the new
     changeset. Use --no-rebase to avoid the rebase.
     """
-    opts = pycompat.byteskwargs(opts)
     revlist = []
-    if opts.get(b'rev'):
-        revlist.append(opts.get(b'rev'))
+    if opts.get('rev'):
+        revlist.append(opts.get('rev'))
     revlist.extend(revs)
     with repo.wlock(), repo.lock():
         tr = repo.transaction(b'split')
@@ -89,7 +87,7 @@
             if ctx.node() is None:
                 raise error.InputError(_(b'cannot split working directory'))
 
-            if opts.get(b'rebase'):
+            if opts.get('rebase'):
                 # Skip obsoleted descendants and their descendants so the rebase
                 # won't cause conflicts for sure.
                 descendants = list(repo.revs(b'(%d::) - (%d)', rev, rev))
@@ -116,7 +114,7 @@
             wnode = repo[b'.'].node()
             top = None
             try:
-                top = dosplit(ui, repo, tr, ctx, opts)
+                top = dosplit(ui, repo, tr, ctx, **opts)
             finally:
                 # top is None: split failed, need update --clean recovery.
                 # wnode == ctx.node(): wnode split, no need to update.
@@ -128,7 +126,7 @@
                 dorebase(ui, repo, torebase, top)
 
 
-def dosplit(ui, repo, tr, ctx, opts):
+def dosplit(ui, repo, tr, ctx, **opts):
     committed = []  # [ctx]
 
     # Set working parent to ctx.p1(), and keep working copy as ctx's content
@@ -166,13 +164,13 @@
             ) % short(ctx.node())
         opts.update(
             {
-                b'edit': True,
-                b'interactive': True,
-                b'message': header + ctx.description(),
+                'edit': True,
+                'interactive': True,
+                'message': header + ctx.description(),
             }
         )
         origctx = repo[b'.']
-        commands.commit(ui, repo, **pycompat.strkwargs(opts))
+        commands.commit(ui, repo, **opts)
         newctx = repo[b'.']
         # Ensure user didn't do a "no-op" split (such as deselecting
         # everything).