mercurial/templatekw.py
changeset 31880 a0f2d83f8083
parent 31879 868ec199cad0
child 31881 31dad7a5b4ed
--- a/mercurial/templatekw.py	Sun Apr 24 19:15:34 2016 +0900
+++ b/mercurial/templatekw.py	Tue Apr 04 22:19:02 2017 +0900
@@ -35,8 +35,6 @@
         self.values = values
         self._makemap = makemap
         self.joinfmt = joinfmt
-    def __iter__(self):
-        return self.gen
     def itermaps(self):
         makemap = self._makemap
         for x in self.values:
@@ -50,6 +48,13 @@
             raise AttributeError(name)
         return getattr(self.values, name)
 
+def unwraphybrid(thing):
+    """Return an object which can be stringified possibly by using a legacy
+    template"""
+    if not util.safehasattr(thing, 'gen'):
+        return thing
+    return thing.gen
+
 def showlist(name, values, plural=None, element=None, separator=' ', **args):
     if not element:
         element = name