[PATCH 08 of 11] py3: force hgweb.server error log to internally write unicode

Matt Harbison mharbison72 at gmail.com
Mon Jan 28 00:20:54 EST 2019


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1548632057 18000
#      Sun Jan 27 18:34:17 2019 -0500
# Node ID 2db104a67b26ee9ff2f2b9ba8bb98d52bada7bb9
# Parent  b98988169d4a9c7890b93091683fa4ec38d61a47
py3: force hgweb.server error log to internally write unicode

Otherwise, there's a lot of py2/py3 divergence in the LFS tests because of the
"HG error" lines picking up a b'' prefix.  wsgicgi.py uses procutil.stderr, so I
assume the input was meant to be bytes.

diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py
+++ b/mercurial/hgweb/server.py
@@ -54,7 +54,7 @@ class _error_logger(object):
         self.writelines(str.split('\n'))
     def writelines(self, seq):
         for msg in seq:
-            self.handler.log_error("HG error:  %s", msg)
+            self.handler.log_error(r"HG error:  %s", encoding.strfromlocal(msg))
 
 class _httprequesthandler(httpservermod.basehttprequesthandler):
 


More information about the Mercurial-devel mailing list