mercurial/cmdutil.py
changeset 32834 edde2e974ed0
parent 32832 11e667a8fcba
child 32835 9d76812f9b0b
equal deleted inserted replaced
32833:99df35499cae 32834:edde2e974ed0
  1644         if self._parts['footer']:
  1644         if self._parts['footer']:
  1645             if not self.footer:
  1645             if not self.footer:
  1646                 self.footer = templater.stringify(
  1646                 self.footer = templater.stringify(
  1647                     self.t(self._parts['footer'], **props))
  1647                     self.t(self._parts['footer'], **props))
  1648 
  1648 
  1649 def gettemplate(ui, tmpl, style):
  1649 def _lookuplogtemplate(ui, tmpl, style):
  1650     """
  1650     """
  1651     Find the template matching the given template spec or style.
  1651     Find the template matching the given template spec or style.
  1652     """
  1652     """
  1653 
  1653 
  1654     # ui settings
  1654     # ui settings
  1690         matchfn = scmutil.matchall(repo)
  1690         matchfn = scmutil.matchall(repo)
  1691 
  1691 
  1692     if opts.get('template') == 'json':
  1692     if opts.get('template') == 'json':
  1693         return jsonchangeset(ui, repo, matchfn, opts, buffered)
  1693         return jsonchangeset(ui, repo, matchfn, opts, buffered)
  1694 
  1694 
  1695     tmpl, mapfile = gettemplate(ui, opts.get('template'), opts.get('style'))
  1695     spec = _lookuplogtemplate(ui, opts.get('template'), opts.get('style'))
       
  1696     tmpl, mapfile = spec
  1696 
  1697 
  1697     if not tmpl and not mapfile:
  1698     if not tmpl and not mapfile:
  1698         return changeset_printer(ui, repo, matchfn, opts, buffered)
  1699         return changeset_printer(ui, repo, matchfn, opts, buffered)
  1699 
  1700 
  1700     return changeset_templater(ui, repo, matchfn, opts, tmpl, mapfile, buffered)
  1701     return changeset_templater(ui, repo, matchfn, opts, tmpl, mapfile, buffered)
  2942 
  2943 
  2943     return text
  2944     return text
  2944 
  2945 
  2945 def buildcommittemplate(repo, ctx, subs, extramsg, tmpl):
  2946 def buildcommittemplate(repo, ctx, subs, extramsg, tmpl):
  2946     ui = repo.ui
  2947     ui = repo.ui
  2947     tmpl, mapfile = gettemplate(ui, tmpl, None)
  2948     tmpl, mapfile = _lookuplogtemplate(ui, tmpl, None)
  2948 
  2949 
  2949     t = changeset_templater(ui, repo, None, {}, tmpl, mapfile, False)
  2950     t = changeset_templater(ui, repo, None, {}, tmpl, mapfile, False)
  2950 
  2951 
  2951     for k, v in repo.ui.configitems('committemplate'):
  2952     for k, v in repo.ui.configitems('committemplate'):
  2952         if k != 'changeset':
  2953         if k != 'changeset':