mercurial/templatekw.py
changeset 24238 49cee6d8573d
parent 24237 9ad02823dc5b
child 24239 31f9b1b16d1e
equal deleted inserted replaced
24237:9ad02823dc5b 24238:49cee6d8573d
   198     changeset.
   198     changeset.
   199     """
   199     """
   200     repo = args['ctx']._repo
   200     repo = args['ctx']._repo
   201     bookmarks = args['ctx'].bookmarks()
   201     bookmarks = args['ctx'].bookmarks()
   202     current = repo._bookmarkcurrent
   202     current = repo._bookmarkcurrent
   203     c = [{'bookmark': x, 'current': current} for x in bookmarks]
   203     makemap = lambda v: {'bookmark': v, 'current': current}
       
   204     c = [makemap(v) for v in bookmarks]
   204     f = _showlist('bookmark', bookmarks, **args)
   205     f = _showlist('bookmark', bookmarks, **args)
   205     return _hybrid(f, c, lambda x: x['bookmark'])
   206     return _hybrid(f, c, lambda x: x['bookmark'])
   206 
   207 
   207 def showchildren(**args):
   208 def showchildren(**args):
   208     """:children: List of strings. The children of the changeset."""
   209     """:children: List of strings. The children of the changeset."""
   240 def showextras(**args):
   241 def showextras(**args):
   241     """:extras: List of dicts with key, value entries of the 'extras'
   242     """:extras: List of dicts with key, value entries of the 'extras'
   242     field of this changeset."""
   243     field of this changeset."""
   243     extras = args['ctx'].extra()
   244     extras = args['ctx'].extra()
   244     extras = util.sortdict((k, extras[k]) for k in sorted(extras))
   245     extras = util.sortdict((k, extras[k]) for k in sorted(extras))
   245     c = [{'key': k, 'value': extras[k]} for k in extras]
   246     makemap = lambda k: {'key': k, 'value': extras[k]}
       
   247     c = [makemap(k) for k in extras]
   246     f = _showlist('extra', c, plural='extras', **args)
   248     f = _showlist('extra', c, plural='extras', **args)
   247     return _hybrid(f, c, lambda x: '%s=%s' % (x['key'], x['value']))
   249     return _hybrid(f, c, lambda x: '%s=%s' % (x['key'], x['value']))
   248 
   250 
   249 def showfileadds(**args):
   251 def showfileadds(**args):
   250     """:file_adds: List of strings. Files added by this changeset."""
   252     """:file_adds: List of strings. Files added by this changeset."""
   267             rename = getrenamed(fn, ctx.rev())
   269             rename = getrenamed(fn, ctx.rev())
   268             if rename:
   270             if rename:
   269                 copies.append((fn, rename[0]))
   271                 copies.append((fn, rename[0]))
   270 
   272 
   271     copies = util.sortdict(copies)
   273     copies = util.sortdict(copies)
   272     c = [{'name': k, 'source': copies[k]} for k in copies]
   274     makemap = lambda k: {'name': k, 'source': copies[k]}
       
   275     c = [makemap(k) for k in copies]
   273     f = _showlist('file_copy', c, plural='file_copies', **args)
   276     f = _showlist('file_copy', c, plural='file_copies', **args)
   274     return _hybrid(f, c, lambda x: '%s (%s)' % (x['name'], x['source']))
   277     return _hybrid(f, c, lambda x: '%s (%s)' % (x['name'], x['source']))
   275 
   278 
   276 # showfilecopiesswitch() displays file copies only if copy records are
   279 # showfilecopiesswitch() displays file copies only if copy records are
   277 # provided before calling the templater, usually with a --copies
   280 # provided before calling the templater, usually with a --copies
   280     """:file_copies_switch: List of strings. Like "file_copies" but displayed
   283     """:file_copies_switch: List of strings. Like "file_copies" but displayed
   281     only if the --copied switch is set.
   284     only if the --copied switch is set.
   282     """
   285     """
   283     copies = args['revcache'].get('copies') or []
   286     copies = args['revcache'].get('copies') or []
   284     copies = util.sortdict(copies)
   287     copies = util.sortdict(copies)
   285     c = [{'name': k, 'source': copies[k]} for k in copies]
   288     makemap = lambda k: {'name': k, 'source': copies[k]}
       
   289     c = [makemap(k) for k in copies]
   286     f = _showlist('file_copy', c, plural='file_copies', **args)
   290     f = _showlist('file_copy', c, plural='file_copies', **args)
   287     return _hybrid(f, c, lambda x: '%s (%s)' % (x['name'], x['source']))
   291     return _hybrid(f, c, lambda x: '%s (%s)' % (x['name'], x['source']))
   288 
   292 
   289 def showfiledels(**args):
   293 def showfiledels(**args):
   290     """:file_dels: List of strings. Files removed by this changeset."""
   294     """:file_dels: List of strings. Files removed by this changeset."""