321 getrenamed = cache['getrenamed'] |
321 getrenamed = cache['getrenamed'] |
322 for fn in ctx.files(): |
322 for fn in ctx.files(): |
323 rename = getrenamed(fn, ctx.rev()) |
323 rename = getrenamed(fn, ctx.rev()) |
324 if rename: |
324 if rename: |
325 copies.append((fn, rename)) |
325 copies.append((fn, rename)) |
326 |
326 return templateutil.compatfilecopiesdict(context, mapping, 'file_copy', |
327 copies = util.sortdict(copies) |
327 copies) |
328 return compatdict(context, mapping, 'file_copy', copies, |
|
329 key='name', value='source', fmt='%s (%s)', |
|
330 plural='file_copies') |
|
331 |
328 |
332 # showfilecopiesswitch() displays file copies only if copy records are |
329 # showfilecopiesswitch() displays file copies only if copy records are |
333 # provided before calling the templater, usually with a --copies |
330 # provided before calling the templater, usually with a --copies |
334 # command line switch. |
331 # command line switch. |
335 @templatekeyword('file_copies_switch', requires={'revcache'}) |
332 @templatekeyword('file_copies_switch', requires={'revcache'}) |
336 def showfilecopiesswitch(context, mapping): |
333 def showfilecopiesswitch(context, mapping): |
337 """List of strings. Like "file_copies" but displayed |
334 """List of strings. Like "file_copies" but displayed |
338 only if the --copied switch is set. |
335 only if the --copied switch is set. |
339 """ |
336 """ |
340 copies = context.resource(mapping, 'revcache').get('copies') or [] |
337 copies = context.resource(mapping, 'revcache').get('copies') or [] |
341 copies = util.sortdict(copies) |
338 return templateutil.compatfilecopiesdict(context, mapping, 'file_copy', |
342 return compatdict(context, mapping, 'file_copy', copies, |
339 copies) |
343 key='name', value='source', fmt='%s (%s)', |
|
344 plural='file_copies') |
|
345 |
340 |
346 @templatekeyword('file_dels', requires={'ctx', 'revcache'}) |
341 @templatekeyword('file_dels', requires={'ctx', 'revcache'}) |
347 def showfiledels(context, mapping): |
342 def showfiledels(context, mapping): |
348 """List of strings. Files removed by this changeset.""" |
343 """List of strings. Files removed by this changeset.""" |
349 return _showfilesbystat(context, mapping, 'file_del', 2) |
344 return _showfilesbystat(context, mapping, 'file_del', 2) |