comparison mercurial/help.py @ 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 0cec8ad579d4
children 1b90036f42f0
comparison
equal deleted inserted replaced
32548:d770a08ee9d9 32549:633c635a790a
264 if (not text 264 if (not text
265 or not ui.verbose and any(w in text for w in _exclkeywords)): 265 or not ui.verbose and any(w in text for w in _exclkeywords)):
266 continue 266 continue
267 text = gettext(text) 267 text = gettext(text)
268 if dedent: 268 if dedent:
269 text = textwrap.dedent(text) 269 # Abuse latin1 to use textwrap.dedent() on bytes.
270 text = textwrap.dedent(text.decode('latin1')).encode('latin1')
270 lines = text.splitlines() 271 lines = text.splitlines()
271 doclines = [(lines[0])] 272 doclines = [(lines[0])]
272 for l in lines[1:]: 273 for l in lines[1:]:
273 # Stop once we find some Python doctest 274 # Stop once we find some Python doctest
274 if l.strip().startswith('>>>'): 275 if l.strip().startswith('>>>'):