Mercurial > hg
annotate tests/test-ancestor.py.out @ 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 | 731b2a90983b |
children | c6cd4b8b76f8 |
rev | line source |
---|---|
18079
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
1 % ancestors of [] and not of [1] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
2 [] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
3 % ancestors of [] and not of [] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
4 [] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
5 % ancestors of [12] and not of [] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
6 [0, 1, 2, 4, 6, 7, 9, 12] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
7 % ancestors of [0] and not of [0] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
8 [] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
9 % ancestors of [4, 5, 6] and not of [6, 5, 4] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
10 [] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
11 % ancestors of [-1] and not of [12] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
12 [] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
13 % ancestors of [12] and not of [-1] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
14 [0, 1, 2, 4, 6, 7, 9, 12] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
15 % ancestors of [12] and not of [9] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
16 [12] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
17 % ancestors of [9] and not of [12] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
18 [] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
19 % ancestors of [12, 9] and not of [7] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
20 [6, 9, 12] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
21 % ancestors of [7, 6] and not of [12] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
22 [] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
23 % ancestors of [10] and not of [11, 12] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
24 [5, 10] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
25 % ancestors of [11] and not of [10] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
26 [3, 7, 11] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
27 % ancestors of [11] and not of [10, 12] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
28 [3, 11] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
29 % ancestors of [12] and not of [10] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
30 [6, 7, 9, 12] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
31 % ancestors of [12] and not of [11] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
32 [6, 9, 12] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
33 % ancestors of [10, 11, 12] and not of [13] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
34 [0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
35 % ancestors of [13] and not of [10, 11, 12] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
36 [8, 13] |
18091
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
37 % lazy ancestor set for [], stoprev = 0, inclusive = False |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
38 [] |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
39 % lazy ancestor set for [11, 13], stoprev = 0, inclusive = False |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
40 [7, 8, 3, 4, 1, 0] |
22355
731b2a90983b
test-ancestor: add a test for `ancestor` with ancestry within the initset
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
18091
diff
changeset
|
41 % lazy ancestor set for [1, 3], stoprev = 0, inclusive = False |
731b2a90983b
test-ancestor: add a test for `ancestor` with ancestry within the initset
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
18091
diff
changeset
|
42 [1, 0] |
18091
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
43 % lazy ancestor set for [11, 13], stoprev = 0, inclusive = True |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
44 [11, 13, 7, 8, 3, 4, 1, 0] |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
45 % lazy ancestor set for [11, 13], stoprev = 6, inclusive = False |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
46 [7, 8] |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
47 % lazy ancestor set for [11, 13], stoprev = 6, inclusive = True |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
48 [11, 13, 7, 8] |