mercurial/cmdutil.py
changeset 35483 817a3d20dd01
parent 35469 f1c54d003327
child 35543 a7f7eff4ec08
equal deleted inserted replaced
35482:c240657febb7 35483:817a3d20dd01
  1842                  buffered=False):
  1842                  buffered=False):
  1843         diffopts = diffopts or {}
  1843         diffopts = diffopts or {}
  1844 
  1844 
  1845         changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
  1845         changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
  1846         tres = formatter.templateresources(ui, repo)
  1846         tres = formatter.templateresources(ui, repo)
  1847         self.t = formatter.loadtemplater(ui, tmplspec, resources=tres,
  1847         self.t = formatter.loadtemplater(ui, tmplspec,
       
  1848                                          defaults=templatekw.keywords,
       
  1849                                          resources=tres,
  1848                                          cache=templatekw.defaulttempl)
  1850                                          cache=templatekw.defaulttempl)
  1849         self._counter = itertools.count()
  1851         self._counter = itertools.count()
  1850         self.cache = tres['cache']  # shared with _graphnodeformatter()
  1852         self.cache = tres['cache']  # shared with _graphnodeformatter()
  1851 
  1853 
  1852         self._tref = tmplspec.ref
  1854         self._tref = tmplspec.ref
  1884         return super(changeset_templater, self).close()
  1886         return super(changeset_templater, self).close()
  1885 
  1887 
  1886     def _show(self, ctx, copies, matchfn, hunksfilterfn, props):
  1888     def _show(self, ctx, copies, matchfn, hunksfilterfn, props):
  1887         '''show a single changeset or file revision'''
  1889         '''show a single changeset or file revision'''
  1888         props = props.copy()
  1890         props = props.copy()
  1889         props.update(templatekw.keywords)
       
  1890         props['ctx'] = ctx
  1891         props['ctx'] = ctx
  1891         props['index'] = index = next(self._counter)
  1892         props['index'] = index = next(self._counter)
  1892         props['revcache'] = {'copies': copies}
  1893         props['revcache'] = {'copies': copies}
  1893         props = pycompat.strkwargs(props)
  1894         props = pycompat.strkwargs(props)
  1894 
  1895 
  2656 
  2657 
  2657     spec = templater.unquotestring(spec)
  2658     spec = templater.unquotestring(spec)
  2658     tres = formatter.templateresources(ui)
  2659     tres = formatter.templateresources(ui)
  2659     if isinstance(displayer, changeset_templater):
  2660     if isinstance(displayer, changeset_templater):
  2660         tres['cache'] = displayer.cache  # reuse cache of slow templates
  2661         tres['cache'] = displayer.cache  # reuse cache of slow templates
  2661     templ = formatter.maketemplater(ui, spec, resources=tres)
  2662     templ = formatter.maketemplater(ui, spec, defaults=templatekw.keywords,
  2662     props = templatekw.keywords.copy()
  2663                                     resources=tres)
  2663     def formatnode(repo, ctx):
  2664     def formatnode(repo, ctx):
  2664         props['ctx'] = ctx
  2665         props = {'ctx': ctx, 'repo': repo, 'revcache': {}}
  2665         props['repo'] = repo
       
  2666         props['revcache'] = {}
       
  2667         return templ.render(props)
  2666         return templ.render(props)
  2668     return formatnode
  2667     return formatnode
  2669 
  2668 
  2670 def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None,
  2669 def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None,
  2671                  filematcher=None, props=None):
  2670                  filematcher=None, props=None):