Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 22013:de5cee8ba088
cmdutil: use '[committemplate]' section like as map file for style definition
Before this patch, each template definitions for 'changeset*' in
'[committemplate]' section have to be written fully from scratch,
even though many parts of them may be common.
This patch uses '[committemplate]' section like as the map file for
the style definition. All items other than 'changeset' can be referred
from others.
This can reduce total cost of template customization in
'[committemplate]' section.
When the commit template other than '[committemplate] changeset'
is chosen by 'editform', putting '[committemplate] changeset'
value into the cache of the templater causes unexpected result,
because the templater stores the specified (= chosen) template
definition into own cache as 'changeset' at construction time.
This is the reason why '[committemplate] changeset' can't be referred
from others.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sat, 02 Aug 2014 21:46:27 +0900 |
parents | 9d92b9d1e282 |
children | fc8bc2787528 |
comparison
equal
deleted
inserted
replaced
22012:9d92b9d1e282 | 22013:de5cee8ba088 |
---|---|
2226 try: | 2226 try: |
2227 t = changeset_templater(ui, repo, None, {}, tmpl, mapfile, False) | 2227 t = changeset_templater(ui, repo, None, {}, tmpl, mapfile, False) |
2228 except SyntaxError, inst: | 2228 except SyntaxError, inst: |
2229 raise util.Abort(inst.args[0]) | 2229 raise util.Abort(inst.args[0]) |
2230 | 2230 |
2231 for k, v in repo.ui.configitems('committemplate'): | |
2232 if k != 'changeset': | |
2233 t.t.cache[k] = v | |
2234 | |
2231 if not extramsg: | 2235 if not extramsg: |
2232 extramsg = '' # ensure that extramsg is string | 2236 extramsg = '' # ensure that extramsg is string |
2233 | 2237 |
2234 ui.pushbuffer() | 2238 ui.pushbuffer() |
2235 t.show(ctx, extramsg=extramsg) | 2239 t.show(ctx, extramsg=extramsg) |