##// END OF EJS Templates
templatekw: extract function that computes and caches file status
Yuya Nishihara -
r39633:16482756 default
parent child Browse files
Show More
@@ -291,12 +291,16 b' def showextras(context, mapping):'
291 return _hybrid(f, extras, makemap,
291 return _hybrid(f, extras, makemap,
292 lambda k: '%s=%s' % (k, stringutil.escapestr(extras[k])))
292 lambda k: '%s=%s' % (k, stringutil.escapestr(extras[k])))
293
293
294 def _showfilesbystat(context, mapping, name, index):
294 def _getfilestatus(context, mapping):
295 ctx = context.resource(mapping, 'ctx')
295 ctx = context.resource(mapping, 'ctx')
296 revcache = context.resource(mapping, 'revcache')
296 revcache = context.resource(mapping, 'revcache')
297 if 'files' not in revcache:
297 if 'files' not in revcache:
298 revcache['files'] = ctx.p1().status(ctx)[:3]
298 revcache['files'] = ctx.p1().status(ctx)[:3]
299 files = revcache['files'][index]
299 return revcache['files']
300
301 def _showfilesbystat(context, mapping, name, index):
302 stat = _getfilestatus(context, mapping)
303 files = stat[index]
300 return templateutil.compatfileslist(context, mapping, name, files)
304 return templateutil.compatfileslist(context, mapping, name, files)
301
305
302 @templatekeyword('file_adds', requires={'ctx', 'revcache'})
306 @templatekeyword('file_adds', requires={'ctx', 'revcache'})
General Comments 0
You need to be logged in to leave comments. Login now