changeset 50908:2eca8b5c8cbd

uncommit: migrate `opts` to native kwargs
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 20 Aug 2023 17:19:33 -0400
parents b5066b2b40f2
children 12476986d89c
files hgext/uncommit.py
diffstat 1 files changed, 9 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/uncommit.py	Sun Aug 20 17:16:38 2023 -0400
+++ b/hgext/uncommit.py	Sun Aug 20 17:19:33 2023 -0400
@@ -152,7 +152,6 @@
     """
     cmdutil.check_note_size(opts)
     cmdutil.resolve_commit_options(ui, opts)
-    opts = pycompat.byteskwargs(opts)
 
     with repo.wlock(), repo.lock():
 
@@ -160,7 +159,7 @@
         m, a, r, d = st.modified, st.added, st.removed, st.deleted
         isdirtypath = any(set(m + a + r + d) & set(pats))
         allowdirtywcopy = opts[
-            b'allow_dirty_working_copy'
+            'allow_dirty_working_copy'
         ] or repo.ui.configbool(b'experimental', b'uncommitondirtywdir')
         if not allowdirtywcopy and (not pats or isdirtypath):
             cmdutil.bailifchanged(
@@ -172,7 +171,7 @@
         if len(old.parents()) > 1:
             raise error.InputError(_(b"cannot uncommit merge changeset"))
 
-        match = scmutil.match(old, pats, opts)
+        match = scmutil.match(old, pats, pycompat.byteskwargs(opts))
 
         # Check all explicitly given files; abort if there's a problem.
         if match.files():
@@ -203,14 +202,14 @@
                 )
 
         with repo.transaction(b'uncommit'):
-            if not (opts[b'message'] or opts[b'logfile']):
-                opts[b'message'] = old.description()
-            message = cmdutil.logmessage(ui, opts)
+            if not (opts['message'] or opts['logfile']):
+                opts['message'] = old.description()
+            message = cmdutil.logmessage(ui, pycompat.byteskwargs(opts))
 
             keepcommit = pats
             if not keepcommit:
-                if opts.get(b'keep') is not None:
-                    keepcommit = opts.get(b'keep')
+                if opts.get('keep') is not None:
+                    keepcommit = opts.get('keep')
                 else:
                     keepcommit = ui.configbool(
                         b'experimental', b'uncommit.keep'
@@ -221,8 +220,8 @@
                 match,
                 keepcommit,
                 message=message,
-                user=opts.get(b'user'),
-                date=opts.get(b'date'),
+                user=opts.get('user'),
+                date=opts.get('date'),
             )
             if newid is None:
                 ui.status(_(b"nothing to uncommit\n"))