Mercurial > public > mercurial-scm > hg
comparison mercurial/templater.py @ 36712:e79adc12cde3
templater: show repr of string we're rejecting
I feel like this should make it a little easier to hunt down problems.
Differential Revision: https://phab.mercurial-scm.org/D2659
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 04 Mar 2018 12:33:15 -0500 |
parents | 1b179d151578 |
children | 543afbdc8e59 |
comparison
equal
deleted
inserted
replaced
36711:a2fa51415ddc | 36712:e79adc12cde3 |
---|---|
1324 yield thing | 1324 yield thing |
1325 elif isinstance(thing, str): | 1325 elif isinstance(thing, str): |
1326 # We can only hit this on Python 3, and it's here to guard | 1326 # We can only hit this on Python 3, and it's here to guard |
1327 # against infinite recursion. | 1327 # against infinite recursion. |
1328 raise error.ProgrammingError('Mercurial IO including templates is done' | 1328 raise error.ProgrammingError('Mercurial IO including templates is done' |
1329 ' with bytes, not strings') | 1329 ' with bytes, not strings, got %r' % thing) |
1330 elif thing is None: | 1330 elif thing is None: |
1331 pass | 1331 pass |
1332 elif not util.safehasattr(thing, '__iter__'): | 1332 elif not util.safehasattr(thing, '__iter__'): |
1333 yield pycompat.bytestr(thing) | 1333 yield pycompat.bytestr(thing) |
1334 else: | 1334 else: |