mercurial/templatekw.py
changeset 15155 f4a8d754cd0a
parent 14437 cbe13e6bdc34
child 15422 042e11c4e416
equal deleted inserted replaced
15154:aa2e908c521e 15155:f4a8d754cd0a
     5 # This software may be used and distributed according to the terms of the
     5 # This software may be used and distributed according to the terms of the
     6 # GNU General Public License version 2 or any later version.
     6 # GNU General Public License version 2 or any later version.
     7 
     7 
     8 from node import hex
     8 from node import hex
     9 import patch, util, error
     9 import patch, util, error
       
    10 import hbisect
    10 
    11 
    11 def showlist(name, values, plural=None, **args):
    12 def showlist(name, values, plural=None, **args):
    12     '''expand set of values.
    13     '''expand set of values.
    13     name is name of key in template map.
    14     name is name of key in template map.
    14     values is list of strings or dicts.
    15     values is list of strings or dicts.
   143 
   144 
   144 def showauthor(repo, ctx, templ, **args):
   145 def showauthor(repo, ctx, templ, **args):
   145     """:author: String. The unmodified author of the changeset."""
   146     """:author: String. The unmodified author of the changeset."""
   146     return ctx.user()
   147     return ctx.user()
   147 
   148 
       
   149 def showbisect(repo, ctx, templ, **args):
       
   150     """:bisect: String. The changeset bisection status."""
       
   151     return hbisect.label(repo, ctx.node())
       
   152 
   148 def showbranch(**args):
   153 def showbranch(**args):
   149     """:branch: String. The name of the branch on which the changeset was
   154     """:branch: String. The name of the branch on which the changeset was
   150     committed.
   155     committed.
   151     """
   156     """
   152     return args['ctx'].branch()
   157     return args['ctx'].branch()
   286 # templ - the templater instance
   291 # templ - the templater instance
   287 # cache - a cache dictionary for the whole templater run
   292 # cache - a cache dictionary for the whole templater run
   288 # revcache - a cache dictionary for the current revision
   293 # revcache - a cache dictionary for the current revision
   289 keywords = {
   294 keywords = {
   290     'author': showauthor,
   295     'author': showauthor,
       
   296     'bisect': showbisect,
   291     'branch': showbranch,
   297     'branch': showbranch,
   292     'branches': showbranches,
   298     'branches': showbranches,
   293     'bookmarks': showbookmarks,
   299     'bookmarks': showbookmarks,
   294     'children': showchildren,
   300     'children': showchildren,
   295     'date': showdate,
   301     'date': showdate,