# HG changeset patch # User Yuya Nishihara # Date 2018-06-05 12:40:33 # Node ID 354fad8697fddfbc079b943229b8f9c17117c6a6 # Parent 4b0f39e7406e1063bc3cfd5a9616f35651255aeb templater: fix string representation of wrapped None flatten() and stringify() skip None, which means wrappedvalue(None).show() must return '' instead of 'None'. This isn't a problem right now, but we'll encounter it once we start using wrapped types extensively. diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -155,6 +155,8 @@ class wrappedvalue(wrapped): raise error.ParseError(_('%r is not iterable') % self._value) def show(self, context, mapping): + if self._value is None: + return b'' return pycompat.bytestr(self._value) def tovalue(self, context, mapping):