# HG changeset patch
# User Augie Fackler <r...@durin42.com>
# Date 1496001067 14400
#      Sun May 28 15:51:07 2017 -0400
# Node ID f1be99397daee2fa8bd9d04cb1296cb7e0260c0d
# Parent  c52ab13885c505252bddf459e3ef86fe1fb8f560
help: work around textwrap.dedent() only working on strings

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -270,7 +270,8 @@ def makeitemsdoc(ui, topic, doc, marker,
             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:]:
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to