comparison mercurial/templateutil.py @ 39367:83f8f7b9fa60

templatekw: alias {file} of files list to {path} This is a part of the name unification. All {path}s will be changed to repository-absolute (i.e. canonical) paths. https://www.mercurial-scm.org/wiki/GenericTemplatingPlan#Dictionary
author Yuya Nishihara <yuya@tcha.org>
date Sun, 05 Aug 2018 16:14:18 +0900
parents 382b055cc358
children 5b1d406b39f1
comparison
equal deleted inserted replaced
39366:a41497b5117c 39367:83f8f7b9fa60
567 This exists for backward compatibility with the old-style template. Use 567 This exists for backward compatibility with the old-style template. Use
568 hybridlist() for new template keywords. 568 hybridlist() for new template keywords.
569 """ 569 """
570 f = _showcompatlist(context, mapping, name, data, plural, separator) 570 f = _showcompatlist(context, mapping, name, data, plural, separator)
571 return hybridlist(data, name=element or name, fmt=fmt, gen=f) 571 return hybridlist(data, name=element or name, fmt=fmt, gen=f)
572
573 def compatfileslist(context, mapping, name, files):
574 """Wrap list of file names to support old-style list template and field
575 names
576
577 This exists for backward compatibility. Use hybridlist for new template
578 keywords.
579 """
580 f = _showcompatlist(context, mapping, name, files)
581 return hybrid(f, files, lambda x: {'file': x, 'path': x},
582 pycompat.identity)
572 583
573 def _showcompatlist(context, mapping, name, values, plural=None, separator=' '): 584 def _showcompatlist(context, mapping, name, values, plural=None, separator=' '):
574 """Return a generator that renders old-style list template 585 """Return a generator that renders old-style list template
575 586
576 name is name of key in template map. 587 name is name of key in template map.