[PATCH 2 of 5] py3: fix bytes-unicode dance while building docstring of extdiff
Yuya Nishihara
yuya at tcha.org
Sat Feb 17 05:07:37 EST 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1518858891 -32400
# Sat Feb 17 18:14:51 2018 +0900
# Node ID c9ac00127748f7ba34ed4119d2802fba4945235a
# Parent d5e06baf9e6bc6705fb4c7e7ab1926bca0a2bae3
py3: fix bytes-unicode dance while building docstring of extdiff
diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -366,7 +366,7 @@ class savedcmd(object):
# 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):
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -2427,7 +2427,7 @@ def forcebytestr(obj):
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):
More information about the Mercurial-devel
mailing list