changeset 32549:633c635a790a

help: work around textwrap.dedent() only working on strings
author Augie Fackler <raf@durin42.com>
date Sun, 28 May 2017 15:51:07 -0400
parents d770a08ee9d9
children b98199a5c3e1
files mercurial/help.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/help.py	Sun May 28 15:43:06 2017 -0400
+++ b/mercurial/help.py	Sun May 28 15:51:07 2017 -0400
@@ -266,7 +266,8 @@
             continue
         text = gettext(text)
         if dedent:
-            text = textwrap.dedent(text)
+            # Abuse latin1 to use textwrap.dedent() on bytes.
+            text = textwrap.dedent(text.decode('latin1')).encode('latin1')
         lines = text.splitlines()
         doclines = [(lines[0])]
         for l in lines[1:]: