Mercurial > hg
annotate mercurial/templates/map-cmdline.phases @ 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 | 66bf251ee672 |
children | e810c7da1cae |
rev | line source |
---|---|
22767
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
1 # Base templates. Due to name clashes with existing keywords, we have |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
2 # to replace some keywords with 'lkeyword', for 'labelled keyword' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
3 changeset = '{cset}{branches}{bookmarks}{tags}{lphase}{parents}{user}{ldate}{summary}\n' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
4 changeset_quiet = '{node}' |
22768
66bf251ee672
log: show phase in hg log -v with the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
22767
diff
changeset
|
5 changeset_verbose = '{cset}{branches}{bookmarks}{tags}{lphase}{parents}{user}{ldate}{lfiles}{lfile_copies_switch}{description}\n' |
22767
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
6 changeset_debug = '{fullcset}{branches}{bookmarks}{tags}{lphase}{parents}{manifest}{user}{ldate}{lfile_mods}{lfile_adds}{lfile_dels}{lfile_copies_switch}{extras}{description}\n' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
7 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
8 # File templates |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
9 lfiles = '{if(files, |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
10 label("ui.note log.files", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
11 "files: {files}\n"))}' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
12 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
13 lfile_mods = '{if(file_mods, |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
14 label("ui.debug log.files", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
15 "files: {file_mods}\n"))}' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
16 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
17 lfile_adds = '{if(file_adds, |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
18 label("ui.debug log.files", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
19 "files+: {file_adds}\n"))}' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
20 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
21 lfile_dels = '{if(file_dels, |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
22 label("ui.debug log.files", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
23 "files-: {file_dels}\n"))}' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
24 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
25 lfile_copies_switch = '{if(file_copies_switch, |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
26 label("ui.note log.copies", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
27 "copies: {file_copies_switch |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
28 % ' {name} ({source})'}\n"))}' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
29 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
30 # General templates |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
31 cset = '{label("log.changeset changeset.{phase}", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
32 "changeset: {rev}:{node|short}")}\n' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
33 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
34 lphase = '{label("log.phase", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
35 "phase: {phase}")}\n' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
36 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
37 fullcset = '{label("log.changeset changeset.{phase}", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
38 "changeset: {rev}:{node}")}\n' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
39 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
40 parent = '{label("log.parent changeset.{phase}", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
41 "parent: {rev}:{node|formatnode}")}\n' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
42 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
43 node = '{label("log.node", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
44 "{rev}:{node|short}")}\n' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
45 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
46 manifest = '{label("ui.debug log.manifest", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
47 "manifest: {rev}:{node}")}\n' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
48 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
49 branch = '{label("log.branch", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
50 "branch: {branch}")}\n' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
51 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
52 tag = '{label("log.tag", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
53 "tag: {tag}")}\n' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
54 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
55 bookmark = '{label("log.bookmark", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
56 "bookmark: {bookmark}")}\n' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
57 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
58 user = '{label("log.user", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
59 "user: {author}")}\n' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
60 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
61 summary = '{label("log.summary", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
62 "summary: {desc|firstline}")}\n' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
63 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
64 ldate = '{label("log.date", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
65 "date: {date|date}")}\n' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
66 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
67 extra = '{label("ui.debug log.extra", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
68 "extra: {key}={value|stringescape}")}\n' |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
69 |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
70 description = '{label("ui.note log.description", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
71 "description:")} |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
72 {label("ui.note log.description", |
9579034d9eb2
log: add labels to the phase template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19126
diff
changeset
|
73 "{desc|strip}")}\n\n' |