1530 self.footer = templater.stringify( |
1530 self.footer = templater.stringify( |
1531 self.t(self._parts['footer'], **props)) |
1531 self.t(self._parts['footer'], **props)) |
1532 except KeyError as inst: |
1532 except KeyError as inst: |
1533 msg = _("%s: no key named '%s'") |
1533 msg = _("%s: no key named '%s'") |
1534 raise error.Abort(msg % (self.t.mapfile, inst.args[0])) |
1534 raise error.Abort(msg % (self.t.mapfile, inst.args[0])) |
1535 except SyntaxError as inst: |
|
1536 raise error.Abort('%s: %s' % (self.t.mapfile, inst.args[0])) |
|
1537 |
1535 |
1538 def gettemplate(ui, tmpl, style): |
1536 def gettemplate(ui, tmpl, style): |
1539 """ |
1537 """ |
1540 Find the template matching the given template spec or style. |
1538 Find the template matching the given template spec or style. |
1541 """ |
1539 """ |
1588 tmpl, mapfile = gettemplate(ui, opts.get('template'), opts.get('style')) |
1586 tmpl, mapfile = gettemplate(ui, opts.get('template'), opts.get('style')) |
1589 |
1587 |
1590 if not tmpl and not mapfile: |
1588 if not tmpl and not mapfile: |
1591 return changeset_printer(ui, repo, matchfn, opts, buffered) |
1589 return changeset_printer(ui, repo, matchfn, opts, buffered) |
1592 |
1590 |
1593 try: |
1591 return changeset_templater(ui, repo, matchfn, opts, tmpl, mapfile, buffered) |
1594 t = changeset_templater(ui, repo, matchfn, opts, tmpl, mapfile, |
|
1595 buffered) |
|
1596 except SyntaxError as inst: |
|
1597 raise error.Abort(inst.args[0]) |
|
1598 return t |
|
1599 |
1592 |
1600 def showmarker(ui, marker, index=None): |
1593 def showmarker(ui, marker, index=None): |
1601 """utility function to display obsolescence marker in a readable way |
1594 """utility function to display obsolescence marker in a readable way |
1602 |
1595 |
1603 To be used by debug function.""" |
1596 To be used by debug function.""" |
2841 |
2834 |
2842 def buildcommittemplate(repo, ctx, subs, extramsg, tmpl): |
2835 def buildcommittemplate(repo, ctx, subs, extramsg, tmpl): |
2843 ui = repo.ui |
2836 ui = repo.ui |
2844 tmpl, mapfile = gettemplate(ui, tmpl, None) |
2837 tmpl, mapfile = gettemplate(ui, tmpl, None) |
2845 |
2838 |
2846 try: |
2839 t = changeset_templater(ui, repo, None, {}, tmpl, mapfile, False) |
2847 t = changeset_templater(ui, repo, None, {}, tmpl, mapfile, False) |
|
2848 except SyntaxError as inst: |
|
2849 raise error.Abort(inst.args[0]) |
|
2850 |
2840 |
2851 for k, v in repo.ui.configitems('committemplate'): |
2841 for k, v in repo.ui.configitems('committemplate'): |
2852 if k != 'changeset': |
2842 if k != 'changeset': |
2853 t.t.cache[k] = v |
2843 t.t.cache[k] = v |
2854 |
2844 |