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

login
register
mail settings
Submitter Augie Fackler
Date March 21, 2017, 1:56 a.m.
Message ID <cdcbc8ac3d4b38099eab.1490061411@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/19493/
State Changes Requested
Headers show

Comments

Augie Fackler - March 21, 2017, 1:56 a.m.
# HG changeset patch
# User Augie Fackler <augie@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.

Patch

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'),