mercurial/templatekw.py
changeset 42405 0c72eddb4be5
parent 42371 b47e9712000b
child 42436 dc5bd66a8270
equal deleted inserted replaced
42404:0c0a22f5b0b5 42405:0c72eddb4be5
   288         revcache['filestatusmap'] = statmap = {}
   288         revcache['filestatusmap'] = statmap = {}
   289         for char, files in zip(pycompat.iterbytestr('MAR!?IC'), stat):
   289         for char, files in zip(pycompat.iterbytestr('MAR!?IC'), stat):
   290             statmap.update((f, char) for f in files)
   290             statmap.update((f, char) for f in files)
   291     return revcache['filestatusmap']  # {path: statchar}
   291     return revcache['filestatusmap']  # {path: statchar}
   292 
   292 
   293 def _showfilesbystat(context, mapping, name, index):
       
   294     stat = _getfilestatus(context, mapping)
       
   295     files = stat[index]
       
   296     return templateutil.compatfileslist(context, mapping, name, files)
       
   297 
       
   298 @templatekeyword('file_copies',
   293 @templatekeyword('file_copies',
   299                  requires={'repo', 'ctx', 'cache', 'revcache'})
   294                  requires={'repo', 'ctx', 'cache', 'revcache'})
   300 def showfilecopies(context, mapping):
   295 def showfilecopies(context, mapping):
   301     """List of strings. Files copied in this changeset with
   296     """List of strings. Files copied in this changeset with
   302     their sources.
   297     their sources.
   330                                              copies)
   325                                              copies)
   331 
   326 
   332 @templatekeyword('file_adds', requires={'ctx', 'revcache'})
   327 @templatekeyword('file_adds', requires={'ctx', 'revcache'})
   333 def showfileadds(context, mapping):
   328 def showfileadds(context, mapping):
   334     """List of strings. Files added by this changeset."""
   329     """List of strings. Files added by this changeset."""
   335     return _showfilesbystat(context, mapping, 'file_add', 1)
   330     ctx = context.resource(mapping, 'ctx')
       
   331     return templateutil.compatfileslist(context, mapping, 'file_add',
       
   332                                         ctx.filesadded())
   336 
   333 
   337 @templatekeyword('file_dels', requires={'ctx', 'revcache'})
   334 @templatekeyword('file_dels', requires={'ctx', 'revcache'})
   338 def showfiledels(context, mapping):
   335 def showfiledels(context, mapping):
   339     """List of strings. Files removed by this changeset."""
   336     """List of strings. Files removed by this changeset."""
   340     return _showfilesbystat(context, mapping, 'file_del', 2)
   337     ctx = context.resource(mapping, 'ctx')
       
   338     return templateutil.compatfileslist(context, mapping, 'file_del',
       
   339                                         ctx.filesremoved())
   341 
   340 
   342 @templatekeyword('file_mods', requires={'ctx', 'revcache'})
   341 @templatekeyword('file_mods', requires={'ctx', 'revcache'})
   343 def showfilemods(context, mapping):
   342 def showfilemods(context, mapping):
   344     """List of strings. Files modified by this changeset."""
   343     """List of strings. Files modified by this changeset."""
   345     return _showfilesbystat(context, mapping, 'file_mod', 0)
   344     ctx = context.resource(mapping, 'ctx')
       
   345     return templateutil.compatfileslist(context, mapping, 'file_mod',
       
   346                                         ctx.filesmodified())
   346 
   347 
   347 @templatekeyword('files', requires={'ctx'})
   348 @templatekeyword('files', requires={'ctx'})
   348 def showfiles(context, mapping):
   349 def showfiles(context, mapping):
   349     """List of strings. All files modified, added, or removed by this
   350     """List of strings. All files modified, added, or removed by this
   350     changeset.
   351     changeset.