changeset 36266:1fa33bd848ee

py3: fix bytes-unicode dance while building docstring of extdiff
author Yuya Nishihara <yuya@tcha.org>
date Sat, 17 Feb 2018 18:14:51 +0900
parents b44fac3a49fb
children 08f061a48a8f
files hgext/extdiff.py mercurial/util.py
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/extdiff.py	Sat Feb 17 18:09:56 2018 +0900
+++ b/hgext/extdiff.py	Sat Feb 17 18:14:51 2018 +0900
@@ -366,7 +366,7 @@
         # We can't pass non-ASCII through docstrings (and path is
         # in an unknown encoding anyway)
         docpath = util.escapestr(path)
-        self.__doc__ = self.__doc__ % {'path': util.uirepr(docpath)}
+        self.__doc__ %= {r'path': pycompat.sysstr(util.uirepr(docpath))}
         self._cmdline = cmdline
 
     def __call__(self, ui, repo, *pats, **opts):
--- a/mercurial/util.py	Sat Feb 17 18:09:56 2018 +0900
+++ b/mercurial/util.py	Sat Feb 17 18:14:51 2018 +0900
@@ -2427,7 +2427,7 @@
 
 def uirepr(s):
     # Avoid double backslash in Windows path repr()
-    return repr(s).replace('\\\\', '\\')
+    return pycompat.byterepr(pycompat.bytestr(s)).replace(b'\\\\', b'\\')
 
 # delay import of textwrap
 def MBTextWrapper(**kwargs):