[PATCH 5 of 5 py3] commit: keep opts as byteskwargs as much as possible

Augie Fackler raf at durin42.com
Mon Mar 20 21:56:51 EDT 2017


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1489900808 14400
#      Sun Mar 19 01:20:08 2017 -0400
# Node ID cdcbc8ac3d4b38099eab928691002e3d004487a5
# Parent  6928c4d2776711c0dbf2f37bb9ee7dfbb959b0db
commit: keep opts as byteskwargs as much as possible

This fixes many flag-handling bugs on 'hg commit' in Python 3.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1636,10 +1636,12 @@ def commit(ui, repo, *pats, **opts):
         release(lock, wlock)
 
 def _docommit(ui, repo, *pats, **opts):
+    opts = pycompat.byteskwargs(opts)
     if opts.get('interactive'):
         opts.pop('interactive')
         ret = cmdutil.dorecord(ui, repo, commit, None, False,
-                               cmdutil.recordfilter, *pats, **opts)
+                               cmdutil.recordfilter, *pats,
+                               **pycompat.strkwargs(opts))
         # ret can be 0 (no changes to record) or the value returned by
         # commit(), 1 if nothing changed or None on success.
         return 1 if ret == 0 else ret
@@ -1711,7 +1713,8 @@ def _docommit(ui, repo, *pats, **opts):
                 with ui.configoverride(overrides, 'commit'):
                     editform = cmdutil.mergeeditform(repo[None],
                                                      'commit.normal')
-                    editor = cmdutil.getcommiteditor(editform=editform, **opts)
+                    editor = cmdutil.getcommiteditor(
+                        editform=editform, **pycompat.strkwargs(opts))
                     return repo.commit(message,
                                        opts.get('user'),
                                        opts.get('date'),


More information about the Mercurial-devel mailing list