diff hgext/lfs/__init__.py @ 37068:aa97e06a1912

templater: use template context to render old-style list template Prepares for dropping the 'templ' resource. This means old-style list templates are processed by the same engine class as the one for the list node. I think that's fine since templates for the same list should be tightly coupled, and I believe the extension point for the engine classes isn't actually used. Now templatekw._showlist() is a compatibility wrapper for _showcompatlist(), and will be deprecated soon. The function is still marked as private since I plan to change the interface to get rid of closures capturing context and mapping.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 16 Mar 2018 22:47:15 +0900
parents 32f9b7e3f056
children a54113fcc8c9
line wrap: on
line diff
--- a/hgext/lfs/__init__.py	Fri Mar 16 22:36:40 2018 +0900
+++ b/hgext/lfs/__init__.py	Fri Mar 16 22:47:15 2018 +0900
@@ -356,12 +356,11 @@
     return [f for f in mctx.subset
             if wrapper.pointerfromctx(mctx.ctx, f, removed=True) is not None]
 
-@templatekeyword('lfs_files', requires={'ctx', 'templ'})
+@templatekeyword('lfs_files', requires={'ctx'})
 def lfsfiles(context, mapping):
     """List of strings. All files modified, added, or removed by this
     changeset."""
     ctx = context.resource(mapping, 'ctx')
-    templ = context.resource(mapping, 'templ')
 
     pointers = wrapper.pointersfromctx(ctx, removed=True) # {path: pointer}
     files = sorted(pointers.keys())
@@ -379,7 +378,7 @@
     }
 
     # TODO: make the separator ', '?
-    f = templateutil._showlist('lfs_file', files, templ, mapping)
+    f = templateutil._showcompatlist(context, mapping, 'lfs_file', files)
     return templateutil.hybrid(f, files, makemap, pycompat.identity)
 
 @command('debuglfsupload',