changeset 29815:0d5cc0c18b4e

templater: make it clearer that _flatten() omits None
author Yuya Nishihara <yuya@tcha.org>
date Thu, 18 Aug 2016 15:55:07 +0900
parents cbf9984a7957
children 034412ca28c3
files mercurial/templater.py
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templater.py	Thu Aug 18 17:25:10 2016 +0200
+++ b/mercurial/templater.py	Thu Aug 18 15:55:07 2016 +0900
@@ -917,17 +917,19 @@
     '''yield a single stream from a possibly nested set of iterators'''
     if isinstance(thing, str):
         yield thing
+    elif thing is None:
+        pass
     elif not util.safehasattr(thing, '__iter__'):
-        if thing is not None:
-            yield str(thing)
+        yield str(thing)
     else:
         for i in thing:
             if isinstance(i, str):
                 yield i
+            elif i is None:
+                pass
             elif not util.safehasattr(i, '__iter__'):
-                if i is not None:
-                    yield str(i)
-            elif i is not None:
+                yield str(i)
+            else:
                 for j in _flatten(i):
                     yield j