mercurial/formatter.py
changeset 32873 2ecce24dfcd3
parent 32841 883adaea9e80
child 32875 c8f2cf18b82e
equal deleted inserted replaced
32872:9fcb6df413c9 32873:2ecce24dfcd3
   429     """Create a templater from either a literal template or loading from
   429     """Create a templater from either a literal template or loading from
   430     a map file"""
   430     a map file"""
   431     assert not (spec.tmpl and spec.mapfile)
   431     assert not (spec.tmpl and spec.mapfile)
   432     if spec.mapfile:
   432     if spec.mapfile:
   433         return templater.templater.frommapfile(spec.mapfile, cache=cache)
   433         return templater.templater.frommapfile(spec.mapfile, cache=cache)
   434     return maketemplater(ui, spec.ref, spec.tmpl, cache=cache)
   434     return _maketemplater(ui, spec.ref, spec.tmpl, cache=cache)
   435 
   435 
   436 def maketemplater(ui, topic, tmpl, cache=None):
   436 def maketemplater(ui, tmpl, cache=None):
   437     """Create a templater from a string template 'tmpl'"""
   437     """Create a templater from a string template 'tmpl'"""
       
   438     return _maketemplater(ui, '', tmpl, cache=cache)
       
   439 
       
   440 def _maketemplater(ui, topic, tmpl, cache=None):
   438     aliases = ui.configitems('templatealias')
   441     aliases = ui.configitems('templatealias')
   439     t = templater.templater(cache=cache, aliases=aliases)
   442     t = templater.templater(cache=cache, aliases=aliases)
   440     if tmpl:
   443     if tmpl:
   441         t.cache[topic] = tmpl
   444         t.cache[topic] = tmpl
   442     return t
   445     return t