##// END OF EJS Templates
changeset_templater: remove use_template method
Matt Mackall -
r20667:e96e9f80 default
parent child Browse files
Show More
@@ -879,14 +879,13 class bugzilla(object):
879 879
880 880 mapfile = self.ui.config('bugzilla', 'style')
881 881 tmpl = self.ui.config('bugzilla', 'template')
882 t = cmdutil.changeset_templater(self.ui, self.repo,
883 False, None, mapfile, False)
884 882 if not mapfile and not tmpl:
885 883 tmpl = _('changeset {node|short} in repo {root} refers '
886 884 'to bug {bug}.\ndetails:\n\t{desc|tabindent}')
887 885 if tmpl:
888 886 tmpl = templater.parsestring(tmpl, quoted=False)
889 t.use_template(tmpl)
887 t = cmdutil.changeset_templater(self.ui, self.repo,
888 False, None, tmpl, mapfile, False)
890 889 self.ui.pushbuffer()
891 890 t.show(ctx, changes=ctx.changeset(),
892 891 bug=str(bugid),
@@ -18,10 +18,10 testedwith = 'internal'
18 18 def maketemplater(ui, repo, tmpl):
19 19 tmpl = templater.parsestring(tmpl, quoted=False)
20 20 try:
21 t = cmdutil.changeset_templater(ui, repo, False, None, None, False)
21 t = cmdutil.changeset_templater(ui, repo, False, None, tmpl,
22 None, False)
22 23 except SyntaxError, inst:
23 24 raise util.Abort(inst.args[0])
24 t.use_template(tmpl)
25 25 return t
26 26
27 27 def changedlines(ui, repo, ctx1, ctx2, fns):
@@ -202,8 +202,7 class hgcia(object):
202 202 template = self.diffstat and self.dstemplate or self.deftemplate
203 203 template = templater.parsestring(template, quoted=False)
204 204 t = cmdutil.changeset_templater(self.ui, self.repo, False, None,
205 style, False)
206 t.use_template(template)
205 template, style, False)
207 206 self.templater = t
208 207
209 208 def strip(self, path):
@@ -218,9 +218,8 class kwtemplater(object):
218 218 '''Replaces keywords in data with expanded template.'''
219 219 def kwsub(mobj):
220 220 kw = mobj.group(1)
221 ct = cmdutil.changeset_templater(self.ui, self.repo,
222 False, None, '', False)
223 ct.use_template(self.templates[kw])
221 ct = cmdutil.changeset_templater(self.ui, self.repo, False, None
222 self.templates[kw], '', False)
224 223 self.ui.pushbuffer()
225 224 ct.show(ctx, root=self.repo.root, file=path)
226 225 ekw = templatefilters.firstline(self.ui.popbuffer())
@@ -188,13 +188,12 class notifier(object):
188 188 mapfile = self.ui.config('notify', 'style')
189 189 template = (self.ui.config('notify', hooktype) or
190 190 self.ui.config('notify', 'template'))
191 self.t = cmdutil.changeset_templater(self.ui, self.repo,
192 False, None, mapfile, False)
193 191 if not mapfile and not template:
194 192 template = deftemplates.get(hooktype) or single_template
195 193 if template:
196 194 template = templater.parsestring(template, quoted=False)
197 self.t.use_template(template)
195 self.t = cmdutil.changeset_templater(self.ui, self.repo, False, None,
196 template, mapfile, False)
198 197
199 198 def strip(self, path):
200 199 '''strip leading slashes from local path, turn into web-safe path.'''
@@ -948,7 +948,7 class changeset_printer(object):
948 948 class changeset_templater(changeset_printer):
949 949 '''format changeset information.'''
950 950
951 def __init__(self, ui, repo, patch, diffopts, mapfile, buffered):
951 def __init__(self, ui, repo, patch, diffopts, tmpl, mapfile, buffered):
952 952 changeset_printer.__init__(self, ui, repo, patch, diffopts, buffered)
953 953 formatnode = ui.debugflag and (lambda x: x) or (lambda x: x[:12])
954 954 defaulttempl = {
@@ -961,11 +961,10 class changeset_templater(changeset_prin
961 961 defaulttempl['filecopy'] = defaulttempl['file_copy']
962 962 self.t = templater.templater(mapfile, {'formatnode': formatnode},
963 963 cache=defaulttempl)
964 self.cache = {}
964 if tmpl:
965 self.t.cache['changeset'] = tmpl
965 966
966 def use_template(self, t):
967 '''set template string to use'''
968 self.t.cache['changeset'] = t
967 self.cache = {}
969 968
970 969 def _meaningful_parentrevs(self, ctx):
971 970 """Return list of meaningful (or all if debug) parentrevs for rev.
@@ -1096,11 +1095,9 def show_changeset(ui, repo, opts, buffe
1096 1095 return changeset_printer(ui, repo, patch, opts, buffered)
1097 1096
1098 1097 try:
1099 t = changeset_templater(ui, repo, patch, opts, mapfile, buffered)
1098 t = changeset_templater(ui, repo, patch, opts, tmpl, mapfile, buffered)
1100 1099 except SyntaxError, inst:
1101 1100 raise util.Abort(inst.args[0])
1102 if tmpl:
1103 t.use_template(tmpl)
1104 1101 return t
1105 1102
1106 1103 def showmarker(ui, marker):
General Comments 0
You need to be logged in to leave comments. Login now