##// END OF EJS Templates
changeset_templater: backport parts map of [templates] section from formatter
Yuya Nishihara -
r32953:6d79e910 default
parent child Browse files
Show More
@@ -1603,6 +1603,10 b' class changeset_templater(changeset_prin'
1603 cur = t + postfix
1603 cur = t + postfix
1604 if mode and cur in self.t:
1604 if mode and cur in self.t:
1605 self._parts[t] = cur
1605 self._parts[t] = cur
1606 else:
1607 partnames = [p for p in self._parts.keys() if p != tmplspec.ref]
1608 m = formatter.templatepartsmap(tmplspec, self.t, partnames)
1609 self._parts.update(m)
1606
1610
1607 if self._parts['docheader']:
1611 if self._parts['docheader']:
1608 self.ui.write(templater.stringify(self.t(self._parts['docheader'])))
1612 self.ui.write(templater.stringify(self.t(self._parts['docheader'])))
@@ -271,6 +271,24 b' Test docheader, docfooter and separator '
271 {"node": "29114dbae42b", "rev": 7}
271 {"node": "29114dbae42b", "rev": 7}
272 }
272 }
273
273
274 Test docheader, docfooter and separator in [templates] section
275
276 $ cat <<'EOF' >> .hg/hgrc
277 > [templates]
278 > myjson = ' {dict(rev, node|short)|json}'
279 > myjson:docheader = '\{\n'
280 > myjson:docfooter = '\n}\n'
281 > myjson:separator = ',\n'
282 > :docheader = 'should not be selected as a docheader for literal templates\n'
283 > EOF
284 $ hg log -l2 -Tmyjson
285 {
286 {"node": "95c24699272e", "rev": 8},
287 {"node": "29114dbae42b", "rev": 7}
288 }
289 $ hg log -l1 -T'{rev}\n'
290 8
291
274 Template should precede style option
292 Template should precede style option
275
293
276 $ hg log -l1 --style default -T '{rev}\n'
294 $ hg log -l1 --style default -T '{rev}\n'
General Comments 0
You need to be logged in to leave comments. Login now