diff -r 4d0465dd13d2 -r 868ec199cad0 mercurial/templatekw.py --- a/mercurial/templatekw.py Sun Apr 09 11:57:09 2017 +0900 +++ b/mercurial/templatekw.py Sun Apr 24 19:15:34 2016 +0900 @@ -19,14 +19,17 @@ util, ) -# This helper class allows us to handle both: -# "{files}" (legacy command-line-specific list hack) and -# "{files % '{file}\n'}" (hgweb-style with inlining and function support) -# and to access raw values: -# "{ifcontains(file, files, ...)}", "{ifcontains(key, extras, ...)}" -# "{get(extras, key)}" +class _hybrid(object): + """Wrapper for list or dict to support legacy template -class _hybrid(object): + This class allows us to handle both: + - "{files}" (legacy command-line-specific list hack) and + - "{files % '{file}\n'}" (hgweb-style with inlining and function support) + and to access raw values: + - "{ifcontains(file, files, ...)}", "{ifcontains(key, extras, ...)}" + - "{get(extras, key)}" + """ + def __init__(self, gen, values, makemap, joinfmt): self.gen = gen self.values = values