Patchwork [6,of,7] py3: convert keys of kwargs back to bytes using pycompat.byteskwargs()

login
register
mail settings
Submitter Pulkit Goyal
Date June 17, 2017, 12:45 p.m.
Message ID <46301f911f32d24da71d.1497703524@workspace>
Download mbox | patch
Permalink /patch/21459/
State Accepted
Headers show

Comments

Pulkit Goyal - June 17, 2017, 12:45 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1497693566 -19800
#      Sat Jun 17 15:29:26 2017 +0530
# Node ID 46301f911f32d24da71dc25ac9dde01e537e3f24
# Parent  48ef02400b59a6d9d250627d0e5f60e85c90cb06
py3: convert keys of kwargs back to bytes using pycompat.byteskwargs()

Patch

diff --git a/hgext/strip.py b/hgext/strip.py
--- a/hgext/strip.py
+++ b/hgext/strip.py
@@ -14,6 +14,7 @@ 
     lock as lockmod,
     merge,
     node as nodemod,
+    pycompat,
     registrar,
     repair,
     scmutil,
@@ -133,6 +134,7 @@ 
 
     Return 0 on success.
     """
+    opts = pycompat.byteskwargs(opts)
     backup = True
     if opts.get('no_backup') or opts.get('nobackup'):
         backup = False
diff --git a/mercurial/formatter.py b/mercurial/formatter.py
--- a/mercurial/formatter.py
+++ b/mercurial/formatter.py
@@ -354,6 +354,7 @@ 
         self._cache = {}  # for templatekw/funcs to store reusable data
     def context(self, **ctxs):
         '''insert context objects to be used to render template keywords'''
+        ctxs = pycompat.byteskwargs(ctxs)
         assert all(k == 'ctx' for k in ctxs)
         self._item.update(ctxs)
     def _showitem(self):
diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -205,6 +205,7 @@ 
     return r
 
 def runhooks(ui, repo, htype, hooks, throw=False, **args):
+    args = pycompat.byteskwargs(args)
     res = {}
     oldstdout = -1