Patchwork [4,of,7] ui: pass in bytes opts dict to logger.log()

login
register
mail settings
Submitter Yuya Nishihara
Date Nov. 27, 2018, 12:57 p.m.
Message ID <8c6e8c636c57e8adc99b.1543323461@mimosa>
Download mbox | patch
Permalink /patch/36812/
State Accepted
Headers show

Comments

Yuya Nishihara - Nov. 27, 2018, 12:57 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1541932581 -32400
#      Sun Nov 11 19:36:21 2018 +0900
# Node ID 8c6e8c636c57e8adc99ba02eb97812fc61c151cc
# Parent  f504187cc42508837296ba92c2261d6879fcacf1
ui: pass in bytes opts dict to logger.log()

This is the convention of the Mercurial API.

Patch

diff --git a/hgext/logtoprocess.py b/hgext/logtoprocess.py
--- a/hgext/logtoprocess.py
+++ b/hgext/logtoprocess.py
@@ -36,9 +36,6 @@  from __future__ import absolute_import
 
 import os
 
-from mercurial import (
-    pycompat,
-)
 from mercurial.utils import (
     procutil,
 )
@@ -70,7 +67,7 @@  class processlogger(object):
         }
         # keyword arguments get prefixed with OPT_ and uppercased
         env.update((b'OPT_%s' % key.upper(), value)
-                   for key, value in pycompat.byteskwargs(opts).items())
+                   for key, value in opts.items())
         fullenv = procutil.shellenviron(env)
         procutil.runbgcommand(script, fullenv, shell=True)
 
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1742,6 +1742,7 @@  class ui(object):
         if not activeloggers:
             return
         msg = msgfmt % msgargs
+        opts = pycompat.byteskwargs(opts)
         # guard against recursion from e.g. ui.debug()
         registeredloggers = self._loggers
         self._loggers = {}