Mercurial > hg
comparison hgext/remotenames.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 | b710fdebd0db |
children | 9938992c5bae |
comparison
equal
deleted
inserted
replaced
37067:04aafcec00b9 | 37068:aa97e06a1912 |
---|---|
228 repo._remotenames.branchtonodes().get(name, []), | 228 repo._remotenames.branchtonodes().get(name, []), |
229 nodemap = lambda repo, node: | 229 nodemap = lambda repo, node: |
230 repo._remotenames.nodetobranch().get(node, [])) | 230 repo._remotenames.nodetobranch().get(node, [])) |
231 repo.names.addnamespace(remotebranchns) | 231 repo.names.addnamespace(remotebranchns) |
232 | 232 |
233 @templatekeyword('remotenames', requires={'repo', 'ctx', 'templ'}) | 233 @templatekeyword('remotenames', requires={'repo', 'ctx'}) |
234 def remotenameskw(context, mapping): | 234 def remotenameskw(context, mapping): |
235 """List of strings. Remote names associated with the changeset.""" | 235 """List of strings. Remote names associated with the changeset.""" |
236 repo = context.resource(mapping, 'repo') | 236 repo = context.resource(mapping, 'repo') |
237 ctx = context.resource(mapping, 'ctx') | 237 ctx = context.resource(mapping, 'ctx') |
238 | 238 |
244 remotenames += repo.names['remotebranches'].names(repo, ctx.node()) | 244 remotenames += repo.names['remotebranches'].names(repo, ctx.node()) |
245 | 245 |
246 return templateutil.compatlist(context, mapping, 'remotename', remotenames, | 246 return templateutil.compatlist(context, mapping, 'remotename', remotenames, |
247 plural='remotenames') | 247 plural='remotenames') |
248 | 248 |
249 @templatekeyword('remotebookmarks', requires={'repo', 'ctx', 'templ'}) | 249 @templatekeyword('remotebookmarks', requires={'repo', 'ctx'}) |
250 def remotebookmarkskw(context, mapping): | 250 def remotebookmarkskw(context, mapping): |
251 """List of strings. Remote bookmarks associated with the changeset.""" | 251 """List of strings. Remote bookmarks associated with the changeset.""" |
252 repo = context.resource(mapping, 'repo') | 252 repo = context.resource(mapping, 'repo') |
253 ctx = context.resource(mapping, 'ctx') | 253 ctx = context.resource(mapping, 'ctx') |
254 | 254 |
257 remotebmarks = repo.names['remotebookmarks'].names(repo, ctx.node()) | 257 remotebmarks = repo.names['remotebookmarks'].names(repo, ctx.node()) |
258 | 258 |
259 return templateutil.compatlist(context, mapping, 'remotebookmark', | 259 return templateutil.compatlist(context, mapping, 'remotebookmark', |
260 remotebmarks, plural='remotebookmarks') | 260 remotebmarks, plural='remotebookmarks') |
261 | 261 |
262 @templatekeyword('remotebranches', requires={'repo', 'ctx', 'templ'}) | 262 @templatekeyword('remotebranches', requires={'repo', 'ctx'}) |
263 def remotebrancheskw(context, mapping): | 263 def remotebrancheskw(context, mapping): |
264 """List of strings. Remote branches associated with the changeset.""" | 264 """List of strings. Remote branches associated with the changeset.""" |
265 repo = context.resource(mapping, 'repo') | 265 repo = context.resource(mapping, 'repo') |
266 ctx = context.resource(mapping, 'ctx') | 266 ctx = context.resource(mapping, 'ctx') |
267 | 267 |