annotate mercurial/templates/raw/map @ 23167:a3c2d9211294 stable

templater: don't overwrite the keyword mapping in runsymbol() (issue4362) This keyword remapping was introduced in e06e9fd2d99f as part of converting generator based iterators into list based iterators, mentioning "undesired behavior in template" when a generator is exhausted, but doesn't say what and introduces no tests. The problem with the remapping was that it corrupted the output for keywords like 'extras', 'file_copies' and 'file_copies_switch' in templates such as: $ hg log -r 142b5d5ec9cc --template "{file_copies % ' File: {file_copy}\n'}" File: mercurial/changelog.py (mercurial/hg.py) File: mercurial/changelog.py (mercurial/hg.py) File: mercurial/changelog.py (mercurial/hg.py) File: mercurial/changelog.py (mercurial/hg.py) File: mercurial/changelog.py (mercurial/hg.py) File: mercurial/changelog.py (mercurial/hg.py) File: mercurial/changelog.py (mercurial/hg.py) File: mercurial/changelog.py (mercurial/hg.py) What was happening was that in the first call to runtemplate() inside runmap(), 'lm' mapped the keyword (e.g. file_copies) to the appropriate showxxx() method. On each subsequent call to runtemplate() in that loop however, the keyword was mapped to a list of the first item's pieces, e.g.: 'file_copy': ['mercurial/changelog.py', ' (', 'mercurial/hg.py', ')'] Therefore, the dict for the second and any subsequent items were not processed through the corresponding showxxx() method, and the first item's data was reused. The 'extras' keyword regressed in de7e6c489412, and 'file_copies' regressed in 0b241d7a8c62 for other reasons. The common thread of things fixed by this seems to be when a list of dicts are passed to the templatekw._hybrid class.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 03 Nov 2014 12:08:03 -0500
parents c8490dcc5fb3
children 47aea60d114d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17277
323de4f49bd1 hgweb: avoid traceback if raw is used as default style
Matt Mackall <mpm@selenic.com>
parents: 16773
diff changeset
1 default = 'shortlog'
323de4f49bd1 hgweb: avoid traceback if raw is used as default style
Matt Mackall <mpm@selenic.com>
parents: 16773
diff changeset
2 shortlog = "'raw' is not a browsable style"
19429
c8490dcc5fb3 hgweb: add changelog and search templates to raw style
Alexander Plavin <me@aplavin.ru>
parents: 17277
diff changeset
3 changelog = changelog.tmpl
c8490dcc5fb3 hgweb: add changelog and search templates to raw style
Alexander Plavin <me@aplavin.ru>
parents: 17277
diff changeset
4 changelogentry = logentry.tmpl
c8490dcc5fb3 hgweb: add changelog and search templates to raw style
Alexander Plavin <me@aplavin.ru>
parents: 17277
diff changeset
5 search = search.tmpl
c8490dcc5fb3 hgweb: add changelog and search templates to raw style
Alexander Plavin <me@aplavin.ru>
parents: 17277
diff changeset
6 searchentry = logentry.tmpl
5928
3340aa5a64f7 hgweb: move HTTP content types out of header templates
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5890
diff changeset
7 mimetype = 'text/plain; charset={encoding}'
3340aa5a64f7 hgweb: move HTTP content types out of header templates
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5890
diff changeset
8 header = ''
1901
c64bef3d7043 use safer string parser for template engine.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1694
diff changeset
9 footer = ''
3277
105253b30239 Moved hgweb map-* files into their style directories and adjusted them.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3236
diff changeset
10 changeset = changeset.tmpl
8429
4bf90ee588b9 raw: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7166
diff changeset
11 difflineplus = '{line}'
4bf90ee588b9 raw: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7166
diff changeset
12 difflineminus = '{line}'
4bf90ee588b9 raw: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7166
diff changeset
13 difflineat = '{line}'
4bf90ee588b9 raw: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7166
diff changeset
14 diffline = '{line}'
4bf90ee588b9 raw: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7166
diff changeset
15 changesetparent = '# Parent {node}'
4bf90ee588b9 raw: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7166
diff changeset
16 changesetchild = '# Child {node}'
1901
c64bef3d7043 use safer string parser for template engine.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1694
diff changeset
17 filenodelink = ''
11936
5b559934d504 templates: add filenolink to raw style (issue2332)
Matt Mackall <mpm@selenic.com>
parents: 9999
diff changeset
18 filenolink = ''
8429
4bf90ee588b9 raw: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7166
diff changeset
19 fileline = '{line}'
4bf90ee588b9 raw: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7166
diff changeset
20 diffblock = '{lines}'
3277
105253b30239 Moved hgweb map-* files into their style directories and adjusted them.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3236
diff changeset
21 filediff = filediff.tmpl
105253b30239 Moved hgweb map-* files into their style directories and adjusted them.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3236
diff changeset
22 fileannotate = fileannotate.tmpl
6967
a04d8cadb6af web: fix annotate raw template, forgotten in ccc2481e3954
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 6177
diff changeset
23 annotateline = '{author|user}@{rev}: {line}'
3941
472d9670e6e9 hgweb: add raw manifest template
Brendan Cully <brendan@kublai.com>
parents: 3277
diff changeset
24 manifest = manifest.tmpl
6177
673d8a6bc709 Renamed "manifest" to "files" in web templates.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5928
diff changeset
25 direntry = 'drwxr-xr-x {basename}\n'
673d8a6bc709 Renamed "manifest" to "files" in web templates.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5928
diff changeset
26 fileentry = '{permissions|permissions} {size} {basename}\n'
4024
de081fbb27fe hgweb: add raw template to hgwebdir
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3941
diff changeset
27 index = index.tmpl
5559
4fca1b181dd9 hgweb: flesh out raw templates
Bryan O'Sullivan <bos@serpentine.com>
parents: 4024
diff changeset
28 notfound = notfound.tmpl
4fca1b181dd9 hgweb: flesh out raw templates
Bryan O'Sullivan <bos@serpentine.com>
parents: 4024
diff changeset
29 error = error.tmpl
8429
4bf90ee588b9 raw: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7166
diff changeset
30 indexentry = '{url}\n'
9946
2059be77d4f8 templates: add raw templates for tags/branches pages
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8429
diff changeset
31 tags = '{entries%tagentry}'
2059be77d4f8 templates: add raw templates for tags/branches pages
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8429
diff changeset
32 tagentry = '{tag} {node}\n'
13921
4788923a2b33 hgweb: add bookmarks listing to raw style with test case
Yuya Nishihara <yuya@tcha.org>
parents: 11936
diff changeset
33 bookmarks = '{entries%bookmarkentry}'
4788923a2b33 hgweb: add bookmarks listing to raw style with test case
Yuya Nishihara <yuya@tcha.org>
parents: 11936
diff changeset
34 bookmarkentry = '{bookmark} {node}\n'
9946
2059be77d4f8 templates: add raw templates for tags/branches pages
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8429
diff changeset
35 branches = '{entries%branchentry}'
2059be77d4f8 templates: add raw templates for tags/branches pages
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8429
diff changeset
36 branchentry = '{branch} {node} {status}\n'
16773
d490edc71146 hgweb: make graph data suitable for template usage
Paul Boddie <paul@boddie.org.uk>
parents: 13921
diff changeset
37 graph = graph.tmpl
d490edc71146 hgweb: make graph data suitable for template usage
Paul Boddie <paul@boddie.org.uk>
parents: 13921
diff changeset
38 graphnode = graphnode.tmpl
d490edc71146 hgweb: make graph data suitable for template usage
Paul Boddie <paul@boddie.org.uk>
parents: 13921
diff changeset
39 graphedge = graphedge.tmpl
d490edc71146 hgweb: make graph data suitable for template usage
Paul Boddie <paul@boddie.org.uk>
parents: 13921
diff changeset
40 bookmarkname = 'bookmark: {name}\n'
d490edc71146 hgweb: make graph data suitable for template usage
Paul Boddie <paul@boddie.org.uk>
parents: 13921
diff changeset
41 branchname = 'branch: {name}\n'
d490edc71146 hgweb: make graph data suitable for template usage
Paul Boddie <paul@boddie.org.uk>
parents: 13921
diff changeset
42 tagname = 'tag: {name}\n'