Show More
@@ -495,17 +495,19 b' def showfileadds(**args):' | |||||
495 | args = pycompat.byteskwargs(args) |
|
495 | args = pycompat.byteskwargs(args) | |
496 | return _showfilesbystat(args, 'file_add', 1) |
|
496 | return _showfilesbystat(args, 'file_add', 1) | |
497 |
|
497 | |||
498 |
@templatekeyword('file_copies' |
|
498 | @templatekeyword('file_copies', | |
499 | def showfilecopies(**args): |
|
499 | requires={'repo', 'ctx', 'cache', 'revcache', 'templ'}) | |
|
500 | def showfilecopies(context, mapping): | |||
500 | """List of strings. Files copied in this changeset with |
|
501 | """List of strings. Files copied in this changeset with | |
501 | their sources. |
|
502 | their sources. | |
502 | """ |
|
503 | """ | |
503 | args = pycompat.byteskwargs(args) |
|
504 | repo = context.resource(mapping, 'repo') | |
504 | cache, ctx = args['cache'], args['ctx'] |
|
505 | ctx = context.resource(mapping, 'ctx') | |
505 | copies = args['revcache'].get('copies') |
|
506 | cache = context.resource(mapping, 'cache') | |
|
507 | copies = context.resource(mapping, 'revcache').get('copies') | |||
506 | if copies is None: |
|
508 | if copies is None: | |
507 | if 'getrenamed' not in cache: |
|
509 | if 'getrenamed' not in cache: | |
508 |
cache['getrenamed'] = getrenamedfn( |
|
510 | cache['getrenamed'] = getrenamedfn(repo) | |
509 | copies = [] |
|
511 | copies = [] | |
510 | getrenamed = cache['getrenamed'] |
|
512 | getrenamed = cache['getrenamed'] | |
511 | for fn in ctx.files(): |
|
513 | for fn in ctx.files(): | |
@@ -514,22 +516,23 b' def showfilecopies(**args):' | |||||
514 | copies.append((fn, rename[0])) |
|
516 | copies.append((fn, rename[0])) | |
515 |
|
517 | |||
516 | copies = util.sortdict(copies) |
|
518 | copies = util.sortdict(copies) | |
517 | return showdict('file_copy', copies, args, plural='file_copies', |
|
519 | return compatdict(context, mapping, 'file_copy', copies, | |
518 |
key='name', value='source', fmt='%s (%s)' |
|
520 | key='name', value='source', fmt='%s (%s)', | |
|
521 | plural='file_copies') | |||
519 |
|
522 | |||
520 | # showfilecopiesswitch() displays file copies only if copy records are |
|
523 | # showfilecopiesswitch() displays file copies only if copy records are | |
521 | # provided before calling the templater, usually with a --copies |
|
524 | # provided before calling the templater, usually with a --copies | |
522 | # command line switch. |
|
525 | # command line switch. | |
523 | @templatekeyword('file_copies_switch') |
|
526 | @templatekeyword('file_copies_switch', requires={'revcache', 'templ'}) | |
524 |
def showfilecopiesswitch( |
|
527 | def showfilecopiesswitch(context, mapping): | |
525 | """List of strings. Like "file_copies" but displayed |
|
528 | """List of strings. Like "file_copies" but displayed | |
526 | only if the --copied switch is set. |
|
529 | only if the --copied switch is set. | |
527 | """ |
|
530 | """ | |
528 | args = pycompat.byteskwargs(args) |
|
531 | copies = context.resource(mapping, 'revcache').get('copies') or [] | |
529 | copies = args['revcache'].get('copies') or [] |
|
|||
530 | copies = util.sortdict(copies) |
|
532 | copies = util.sortdict(copies) | |
531 | return showdict('file_copy', copies, args, plural='file_copies', |
|
533 | return compatdict(context, mapping, 'file_copy', copies, | |
532 |
key='name', value='source', fmt='%s (%s)' |
|
534 | key='name', value='source', fmt='%s (%s)', | |
|
535 | plural='file_copies') | |||
533 |
|
536 | |||
534 | @templatekeyword('file_dels') |
|
537 | @templatekeyword('file_dels') | |
535 | def showfiledels(**args): |
|
538 | def showfiledels(**args): |
General Comments 0
You need to be logged in to leave comments.
Login now