Show More
@@ -1492,9 +1492,9 b' class changeset_templater(changeset_prin' | |||||
1492 | self.t = templater.templater.frommapfile(mapfile, filters=filters, |
|
1492 | self.t = templater.templater.frommapfile(mapfile, filters=filters, | |
1493 | cache=defaulttempl) |
|
1493 | cache=defaulttempl) | |
1494 | else: |
|
1494 | else: | |
1495 |
self.t = |
|
1495 | self.t = formatter.maketemplater(ui, 'changeset', tmpl, | |
1496 | if tmpl: |
|
1496 | filters=filters, | |
1497 | self.t.cache['changeset'] = tmpl |
|
1497 | cache=defaulttempl) | |
1498 |
|
1498 | |||
1499 | self.cache = {} |
|
1499 | self.cache = {} | |
1500 |
|
1500 |
@@ -46,6 +46,7 b' from . import (' | |||||
46 | exchange, |
|
46 | exchange, | |
47 | extensions, |
|
47 | extensions, | |
48 | fileset, |
|
48 | fileset, | |
|
49 | formatter, | |||
49 | graphmod, |
|
50 | graphmod, | |
50 | hbisect, |
|
51 | hbisect, | |
51 | help, |
|
52 | help, | |
@@ -3681,8 +3682,7 b' def debugtemplate(ui, repo, tmpl, **opts' | |||||
3681 | mapfile = None |
|
3682 | mapfile = None | |
3682 | if revs is None: |
|
3683 | if revs is None: | |
3683 | k = 'debugtemplate' |
|
3684 | k = 'debugtemplate' | |
3684 |
t = |
|
3685 | t = formatter.maketemplater(ui, k, tmpl) | |
3685 | t.cache[k] = tmpl |
|
|||
3686 | ui.write(templater.stringify(t(k, **props))) |
|
3686 | ui.write(templater.stringify(t(k, **props))) | |
3687 | else: |
|
3687 | else: | |
3688 | displayer = cmdutil.changeset_templater(ui, repo, None, opts, tmpl, |
|
3688 | displayer = cmdutil.changeset_templater(ui, repo, None, opts, tmpl, |
@@ -17,6 +17,7 b' from .node import nullid, short' | |||||
17 |
|
17 | |||
18 | from . import ( |
|
18 | from . import ( | |
19 | error, |
|
19 | error, | |
|
20 | formatter, | |||
20 | match, |
|
21 | match, | |
21 | scmutil, |
|
22 | scmutil, | |
22 | simplemerge, |
|
23 | simplemerge, | |
@@ -526,7 +527,7 b' def _formatlabels(repo, fcd, fco, fca, l' | |||||
526 |
|
527 | |||
527 | ui = repo.ui |
|
528 | ui = repo.ui | |
528 | template = ui.config('ui', 'mergemarkertemplate', _defaultconflictmarker) |
|
529 | template = ui.config('ui', 'mergemarkertemplate', _defaultconflictmarker) | |
529 |
tmpl = |
|
530 | tmpl = formatter.maketemplater(ui, 'conflictmarker', template) | |
530 |
|
531 | |||
531 | pad = max(len(l) for l in labels) |
|
532 | pad = max(len(l) for l in labels) | |
532 |
|
533 |
@@ -193,7 +193,11 b' def gettemplater(ui, topic, spec):' | |||||
193 | assert not (tmpl and mapfile) |
|
193 | assert not (tmpl and mapfile) | |
194 | if mapfile: |
|
194 | if mapfile: | |
195 | return templater.templater.frommapfile(mapfile) |
|
195 | return templater.templater.frommapfile(mapfile) | |
196 | t = templater.templater() |
|
196 | return maketemplater(ui, topic, tmpl) | |
|
197 | ||||
|
198 | def maketemplater(ui, topic, tmpl, filters=None, cache=None): | |||
|
199 | """Create a templater from a string template 'tmpl'""" | |||
|
200 | t = templater.templater(filters=filters, cache=cache) | |||
197 | if tmpl: |
|
201 | if tmpl: | |
198 | t.cache[topic] = tmpl |
|
202 | t.cache[topic] = tmpl | |
199 | return t |
|
203 | return t |
General Comments 0
You need to be logged in to leave comments.
Login now