Show More
@@ -1587,7 +1587,8 b' class changeset_templater(changeset_prin' | |||||
1587 | self._tref = tmplspec.ref |
|
1587 | self._tref = tmplspec.ref | |
1588 | self._parts = {'header': '', 'footer': '', |
|
1588 | self._parts = {'header': '', 'footer': '', | |
1589 | tmplspec.ref: tmplspec.ref, |
|
1589 | tmplspec.ref: tmplspec.ref, | |
1590 |
'docheader': '', 'docfooter': '' |
|
1590 | 'docheader': '', 'docfooter': '', | |
|
1591 | 'separator': ''} | |||
1591 | if tmplspec.mapfile: |
|
1592 | if tmplspec.mapfile: | |
1592 | # find correct templates for current mode, for backward |
|
1593 | # find correct templates for current mode, for backward | |
1593 | # compatibility with 'log -v/-q/--debug' using a mapfile |
|
1594 | # compatibility with 'log -v/-q/--debug' using a mapfile | |
@@ -1621,11 +1622,17 b' class changeset_templater(changeset_prin' | |||||
1621 | props['ctx'] = ctx |
|
1622 | props['ctx'] = ctx | |
1622 | props['repo'] = self.repo |
|
1623 | props['repo'] = self.repo | |
1623 | props['ui'] = self.repo.ui |
|
1624 | props['ui'] = self.repo.ui | |
1624 | props['index'] = next(self._counter) |
|
1625 | props['index'] = index = next(self._counter) | |
1625 | props['revcache'] = {'copies': copies} |
|
1626 | props['revcache'] = {'copies': copies} | |
1626 | props['cache'] = self.cache |
|
1627 | props['cache'] = self.cache | |
1627 | props = pycompat.strkwargs(props) |
|
1628 | props = pycompat.strkwargs(props) | |
1628 |
|
1629 | |||
|
1630 | # write separator, which wouldn't work well with the header part below | |||
|
1631 | # since there's inherently a conflict between header (across items) and | |||
|
1632 | # separator (per item) | |||
|
1633 | if self._parts['separator'] and index > 0: | |||
|
1634 | self.ui.write(templater.stringify(self.t(self._parts['separator']))) | |||
|
1635 | ||||
1629 | # write header |
|
1636 | # write header | |
1630 | if self._parts['header']: |
|
1637 | if self._parts['header']: | |
1631 | h = templater.stringify(self.t(self._parts['header'], **props)) |
|
1638 | h = templater.stringify(self.t(self._parts['header'], **props)) |
@@ -257,6 +257,20 b' Test template map inheritance' | |||||
257 | summary: third |
|
257 | summary: third | |
258 |
|
258 | |||
259 |
|
259 | |||
|
260 | Test docheader, docfooter and separator in template map | |||
|
261 | ||||
|
262 | $ cat <<'EOF' > map-myjson | |||
|
263 | > docheader = '\{\n' | |||
|
264 | > docfooter = '\n}\n' | |||
|
265 | > separator = ',\n' | |||
|
266 | > changeset = ' {dict(rev, node|short)|json}' | |||
|
267 | > EOF | |||
|
268 | $ hg log -l2 -T./map-myjson | |||
|
269 | { | |||
|
270 | {"node": "95c24699272e", "rev": 8}, | |||
|
271 | {"node": "29114dbae42b", "rev": 7} | |||
|
272 | } | |||
|
273 | ||||
260 | Template should precede style option |
|
274 | Template should precede style option | |
261 |
|
275 | |||
262 | $ hg log -l1 --style default -T '{rev}\n' |
|
276 | $ hg log -l1 --style default -T '{rev}\n' |
General Comments 0
You need to be logged in to leave comments.
Login now