mercurial/templater.py
changeset 26587 56b2bcea2529
parent 26564 bed9e6c706f6
child 27293 9e06e7fb037d
equal deleted inserted replaced
26586:d51c658d3f04 26587:56b2bcea2529
   268     except (ValueError, AttributeError, TypeError):
   268     except (ValueError, AttributeError, TypeError):
   269         if isinstance(arg[1], tuple):
   269         if isinstance(arg[1], tuple):
   270             dt = arg[1][1]
   270             dt = arg[1][1]
   271         else:
   271         else:
   272             dt = arg[1]
   272             dt = arg[1]
   273         raise util.Abort(_("template filter '%s' is not compatible with "
   273         raise error.Abort(_("template filter '%s' is not compatible with "
   274                            "keyword '%s'") % (filt.func_name, dt))
   274                            "keyword '%s'") % (filt.func_name, dt))
   275 
   275 
   276 def buildmap(exp, context):
   276 def buildmap(exp, context):
   277     func, data = compileexp(exp[1], context, methods)
   277     func, data = compileexp(exp[1], context, methods)
   278     ctmpl = gettemplate(exp[2], context)
   278     ctmpl = gettemplate(exp[2], context)
   838         split = file.split(".")
   838         split = file.split(".")
   839         if split[0] == "map-cmdline":
   839         if split[0] == "map-cmdline":
   840             stylelist.append(split[1])
   840             stylelist.append(split[1])
   841     return ", ".join(sorted(stylelist))
   841     return ", ".join(sorted(stylelist))
   842 
   842 
   843 class TemplateNotFound(util.Abort):
   843 class TemplateNotFound(error.Abort):
   844     pass
   844     pass
   845 
   845 
   846 class templater(object):
   846 class templater(object):
   847 
   847 
   848     def __init__(self, mapfile, filters=None, defaults=None, cache=None,
   848     def __init__(self, mapfile, filters=None, defaults=None, cache=None,
   871         self.ecache = {}
   871         self.ecache = {}
   872 
   872 
   873         if not mapfile:
   873         if not mapfile:
   874             return
   874             return
   875         if not os.path.exists(mapfile):
   875         if not os.path.exists(mapfile):
   876             raise util.Abort(_("style '%s' not found") % mapfile,
   876             raise error.Abort(_("style '%s' not found") % mapfile,
   877                              hint=_("available styles: %s") % stylelist())
   877                              hint=_("available styles: %s") % stylelist())
   878 
   878 
   879         conf = config.config(includepaths=templatepaths())
   879         conf = config.config(includepaths=templatepaths())
   880         conf.read(mapfile)
   880         conf.read(mapfile)
   881 
   881