mercurial/templatekw.py
changeset 36475 e8d37838f5df
parent 36472 e46b24582fa0
child 36486 9ff5cbfbc26a
equal deleted inserted replaced
36474:717a279c0c21 36475:e8d37838f5df
   339     'extra': '{key}={value|stringescape}'
   339     'extra': '{key}={value|stringescape}'
   340 }
   340 }
   341 # filecopy is preserved for compatibility reasons
   341 # filecopy is preserved for compatibility reasons
   342 defaulttempl['filecopy'] = defaulttempl['file_copy']
   342 defaulttempl['filecopy'] = defaulttempl['file_copy']
   343 
   343 
   344 # keywords are callables like:
   344 # keywords are callables (see registrar.templatekeyword for details)
   345 # fn(repo, ctx, templ, cache, revcache, **args)
       
   346 # with:
       
   347 # repo - current repository instance
       
   348 # ctx - the changectx being displayed
       
   349 # templ - the templater instance
       
   350 # cache - a cache dictionary for the whole templater run
       
   351 # revcache - a cache dictionary for the current revision
       
   352 keywords = {}
   345 keywords = {}
   353 
       
   354 templatekeyword = registrar.templatekeyword(keywords)
   346 templatekeyword = registrar.templatekeyword(keywords)
   355 
   347 
   356 @templatekeyword('author')
   348 @templatekeyword('author', requires={'ctx'})
   357 def showauthor(repo, ctx, templ, **args):
   349 def showauthor(context, mapping):
   358     """String. The unmodified author of the changeset."""
   350     """String. The unmodified author of the changeset."""
       
   351     ctx = context.resource(mapping, 'ctx')
   359     return ctx.user()
   352     return ctx.user()
   360 
   353 
   361 @templatekeyword('bisect')
   354 @templatekeyword('bisect')
   362 def showbisect(repo, ctx, templ, **args):
   355 def showbisect(repo, ctx, templ, **args):
   363     """String. The changeset bisection status."""
   356     """String. The changeset bisection status."""