Mercurial > hg
annotate tests/test-template-basic.t @ 38446:5b04a0c30f3f
formatter: look for template symbols from the associated name
Otherwise symbolsused() would fail if a named template is specified with -T.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 18 Jun 2018 21:58:04 +0900 |
parents | 550b7d110f45 |
children | b4cfd803b3f2 |
rev | line source |
---|---|
38437
550b7d110f45
tests: rename and document test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
38436
diff
changeset
|
1 Test template syntax and basic functionality |
550b7d110f45
tests: rename and document test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
38436
diff
changeset
|
2 ============================================ |
550b7d110f45
tests: rename and document test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
38436
diff
changeset
|
3 |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
4 $ hg init a |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
5 $ cd a |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
6 $ echo a > a |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
7 $ hg add a |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
8 $ echo line 1 > b |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
9 $ echo line 2 >> b |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
10 $ hg commit -l b -d '1000000 0' -u 'User Name <user@hostname>' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
11 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
12 $ hg add b |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
13 $ echo other 1 > c |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
14 $ echo other 2 >> c |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
15 $ echo >> c |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
16 $ echo other 3 >> c |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
17 $ hg commit -l c -d '1100000 0' -u 'A. N. Other <other@place>' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
18 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
19 $ hg add c |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
20 $ hg commit -m 'no person' -d '1200000 0' -u 'other@place' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
21 $ echo c >> c |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
22 $ hg commit -m 'no user, no domain' -d '1300000 0' -u 'person' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
23 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
24 $ echo foo > .hg/branch |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
25 $ hg commit -m 'new branch' -d '1400000 0' -u 'person' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
26 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
27 $ hg co -q 3 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
28 $ echo other 4 >> d |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
29 $ hg add d |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
30 $ hg commit -m 'new head' -d '1500000 0' -u 'person' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
31 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
32 $ hg merge -q foo |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
33 $ hg commit -m 'merge' -d '1500001 0' -u 'person' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
34 |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
35 Test arithmetic operators have the right precedence: |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
36 |
30237
94ef2f00b8a4
tests: use basic format code "%Y" instead of "%s" for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
30232
diff
changeset
|
37 $ hg log -l 1 -T '{date(date, "%Y") + 5 * 10} {date(date, "%Y") - 2 * 3}\n' |
94ef2f00b8a4
tests: use basic format code "%Y" instead of "%s" for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
30232
diff
changeset
|
38 2020 1964 |
94ef2f00b8a4
tests: use basic format code "%Y" instead of "%s" for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
30232
diff
changeset
|
39 $ hg log -l 1 -T '{date(date, "%Y") * 5 + 10} {date(date, "%Y") * 3 - 2}\n' |
94ef2f00b8a4
tests: use basic format code "%Y" instead of "%s" for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
30232
diff
changeset
|
40 9860 5908 |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
41 |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
42 Test division: |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
43 |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
44 $ hg debugtemplate -r0 -v '{5 / 2} {mod(5, 2)}\n' |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
45 (template |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
46 (/ |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
47 (integer '5') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
48 (integer '2')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
49 (string ' ') |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
50 (func |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
51 (symbol 'mod') |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
52 (list |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
53 (integer '5') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
54 (integer '2'))) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
55 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
56 * keywords: |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
57 * functions: mod |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
58 2 1 |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
59 $ hg debugtemplate -r0 -v '{5 / -2} {mod(5, -2)}\n' |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
60 (template |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
61 (/ |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
62 (integer '5') |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
63 (negate |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
64 (integer '2'))) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
65 (string ' ') |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
66 (func |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
67 (symbol 'mod') |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
68 (list |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
69 (integer '5') |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
70 (negate |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
71 (integer '2')))) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
72 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
73 * keywords: |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
74 * functions: mod |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
75 -3 -1 |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
76 $ hg debugtemplate -r0 -v '{-5 / 2} {mod(-5, 2)}\n' |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
77 (template |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
78 (/ |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
79 (negate |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
80 (integer '5')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
81 (integer '2')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
82 (string ' ') |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
83 (func |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
84 (symbol 'mod') |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
85 (list |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
86 (negate |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
87 (integer '5')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
88 (integer '2'))) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
89 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
90 * keywords: |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
91 * functions: mod |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
92 -3 1 |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
93 $ hg debugtemplate -r0 -v '{-5 / -2} {mod(-5, -2)}\n' |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
94 (template |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
95 (/ |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
96 (negate |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
97 (integer '5')) |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
98 (negate |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
99 (integer '2'))) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
100 (string ' ') |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
101 (func |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
102 (symbol 'mod') |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
103 (list |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
104 (negate |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
105 (integer '5')) |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
106 (negate |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
107 (integer '2')))) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
108 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
109 * keywords: |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
110 * functions: mod |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
111 2 -1 |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
112 |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
113 Filters bind closer than arithmetic: |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
114 |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
115 $ hg debugtemplate -r0 -v '{revset(".")|count - 1}\n' |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
116 (template |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
117 (- |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
118 (| |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
119 (func |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
120 (symbol 'revset') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
121 (string '.')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
122 (symbol 'count')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
123 (integer '1')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
124 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
125 * keywords: |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
126 * functions: count, revset |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
127 0 |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
128 |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
129 But negate binds closer still: |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
130 |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
131 $ hg debugtemplate -r0 -v '{1-3|stringify}\n' |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
132 (template |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
133 (- |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
134 (integer '1') |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
135 (| |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
136 (integer '3') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
137 (symbol 'stringify'))) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
138 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
139 * keywords: |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
140 * functions: stringify |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
141 hg: parse error: arithmetic only defined on integers |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
142 [255] |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
143 $ hg debugtemplate -r0 -v '{-3|stringify}\n' |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
144 (template |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
145 (| |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
146 (negate |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
147 (integer '3')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
148 (symbol 'stringify')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
149 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
150 * keywords: |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
151 * functions: stringify |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
152 -3 |
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
153 |
34329
6367318327f0
templater: adjust binding strength of '%' and '|' operators (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
34073
diff
changeset
|
154 Filters bind as close as map operator: |
6367318327f0
templater: adjust binding strength of '%' and '|' operators (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
34073
diff
changeset
|
155 |
6367318327f0
templater: adjust binding strength of '%' and '|' operators (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
34073
diff
changeset
|
156 $ hg debugtemplate -r0 -v '{desc|splitlines % "{line}\n"}' |
6367318327f0
templater: adjust binding strength of '%' and '|' operators (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
34073
diff
changeset
|
157 (template |
6367318327f0
templater: adjust binding strength of '%' and '|' operators (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
34073
diff
changeset
|
158 (% |
6367318327f0
templater: adjust binding strength of '%' and '|' operators (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
34073
diff
changeset
|
159 (| |
6367318327f0
templater: adjust binding strength of '%' and '|' operators (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
34073
diff
changeset
|
160 (symbol 'desc') |
6367318327f0
templater: adjust binding strength of '%' and '|' operators (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
34073
diff
changeset
|
161 (symbol 'splitlines')) |
6367318327f0
templater: adjust binding strength of '%' and '|' operators (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
34073
diff
changeset
|
162 (template |
6367318327f0
templater: adjust binding strength of '%' and '|' operators (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
34073
diff
changeset
|
163 (symbol 'line') |
6367318327f0
templater: adjust binding strength of '%' and '|' operators (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
34073
diff
changeset
|
164 (string '\n')))) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
165 * keywords: desc, line |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
166 * functions: splitlines |
34329
6367318327f0
templater: adjust binding strength of '%' and '|' operators (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
34073
diff
changeset
|
167 line 1 |
6367318327f0
templater: adjust binding strength of '%' and '|' operators (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
34073
diff
changeset
|
168 line 2 |
6367318327f0
templater: adjust binding strength of '%' and '|' operators (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
34073
diff
changeset
|
169 |
31885
d18b624c1c06
templater: add parsing rule for key-value pair
Yuya Nishihara <yuya@tcha.org>
parents:
31882
diff
changeset
|
170 Keyword arguments: |
d18b624c1c06
templater: add parsing rule for key-value pair
Yuya Nishihara <yuya@tcha.org>
parents:
31882
diff
changeset
|
171 |
d18b624c1c06
templater: add parsing rule for key-value pair
Yuya Nishihara <yuya@tcha.org>
parents:
31882
diff
changeset
|
172 $ hg debugtemplate -r0 -v '{foo=bar|baz}' |
d18b624c1c06
templater: add parsing rule for key-value pair
Yuya Nishihara <yuya@tcha.org>
parents:
31882
diff
changeset
|
173 (template |
d18b624c1c06
templater: add parsing rule for key-value pair
Yuya Nishihara <yuya@tcha.org>
parents:
31882
diff
changeset
|
174 (keyvalue |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
175 (symbol 'foo') |
31885
d18b624c1c06
templater: add parsing rule for key-value pair
Yuya Nishihara <yuya@tcha.org>
parents:
31882
diff
changeset
|
176 (| |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
177 (symbol 'bar') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
178 (symbol 'baz')))) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
179 * keywords: bar, foo |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
180 * functions: baz |
31885
d18b624c1c06
templater: add parsing rule for key-value pair
Yuya Nishihara <yuya@tcha.org>
parents:
31882
diff
changeset
|
181 hg: parse error: can't use a key-value pair in this context |
d18b624c1c06
templater: add parsing rule for key-value pair
Yuya Nishihara <yuya@tcha.org>
parents:
31882
diff
changeset
|
182 [255] |
d18b624c1c06
templater: add parsing rule for key-value pair
Yuya Nishihara <yuya@tcha.org>
parents:
31882
diff
changeset
|
183 |
31887
f7b3677f66cd
templater: port pad() to take keyword arguments
Yuya Nishihara <yuya@tcha.org>
parents:
31886
diff
changeset
|
184 $ hg debugtemplate '{pad("foo", width=10, left=true)}\n' |
f7b3677f66cd
templater: port pad() to take keyword arguments
Yuya Nishihara <yuya@tcha.org>
parents:
31886
diff
changeset
|
185 foo |
f7b3677f66cd
templater: port pad() to take keyword arguments
Yuya Nishihara <yuya@tcha.org>
parents:
31886
diff
changeset
|
186 |
31886
bdda942f4b9c
templater: add support for keyword arguments
Yuya Nishihara <yuya@tcha.org>
parents:
31885
diff
changeset
|
187 Call function which takes named arguments by filter syntax: |
bdda942f4b9c
templater: add support for keyword arguments
Yuya Nishihara <yuya@tcha.org>
parents:
31885
diff
changeset
|
188 |
bdda942f4b9c
templater: add support for keyword arguments
Yuya Nishihara <yuya@tcha.org>
parents:
31885
diff
changeset
|
189 $ hg debugtemplate '{" "|separate}' |
bdda942f4b9c
templater: add support for keyword arguments
Yuya Nishihara <yuya@tcha.org>
parents:
31885
diff
changeset
|
190 $ hg debugtemplate '{("not", "an", "argument", "list")|separate}' |
bdda942f4b9c
templater: add support for keyword arguments
Yuya Nishihara <yuya@tcha.org>
parents:
31885
diff
changeset
|
191 hg: parse error: unknown method 'list' |
bdda942f4b9c
templater: add support for keyword arguments
Yuya Nishihara <yuya@tcha.org>
parents:
31885
diff
changeset
|
192 [255] |
bdda942f4b9c
templater: add support for keyword arguments
Yuya Nishihara <yuya@tcha.org>
parents:
31885
diff
changeset
|
193 |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
194 Second branch starting at nullrev: |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
195 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
196 $ hg update null |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
197 0 files updated, 0 files merged, 4 files removed, 0 files unresolved |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
198 $ echo second > second |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
199 $ hg add second |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
200 $ hg commit -m second -d '1000000 0' -u 'User Name <user@hostname>' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
201 created new head |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
202 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
203 $ echo third > third |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
204 $ hg add third |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
205 $ hg mv second fourth |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
206 $ hg commit -m third -d "2020-01-01 10:01" |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
207 |
18970
3cdb6f2f6789
templatekw: add default styles for hybrid types (issue3887)
Matt Mackall <mpm@selenic.com>
parents:
18893
diff
changeset
|
208 $ hg log --template '{join(file_copies, ",\n")}\n' -r . |
3cdb6f2f6789
templatekw: add default styles for hybrid types (issue3887)
Matt Mackall <mpm@selenic.com>
parents:
18893
diff
changeset
|
209 fourth (second) |
20665
945bc5497e6d
commands: add -T alternative to --template
Matt Mackall <mpm@selenic.com>
parents:
20520
diff
changeset
|
210 $ hg log -T '{file_copies % "{source} -> {name}\n"}' -r . |
18715
c4ff927b6f68
templater: properly handle file_copies with %
Matt Mackall <mpm@selenic.com>
parents:
18207
diff
changeset
|
211 second -> fourth |
24240
bd504d90588d
templater: implement _hybrid.__contains__ so that ifcontains can accept dict
Yuya Nishihara <yuya@tcha.org>
parents:
24157
diff
changeset
|
212 $ hg log -T '{rev} {ifcontains("fourth", file_copies, "t", "f")}\n' -r .:7 |
bd504d90588d
templater: implement _hybrid.__contains__ so that ifcontains can accept dict
Yuya Nishihara <yuya@tcha.org>
parents:
24157
diff
changeset
|
213 8 t |
bd504d90588d
templater: implement _hybrid.__contains__ so that ifcontains can accept dict
Yuya Nishihara <yuya@tcha.org>
parents:
24157
diff
changeset
|
214 7 f |
18715
c4ff927b6f68
templater: properly handle file_copies with %
Matt Mackall <mpm@selenic.com>
parents:
18207
diff
changeset
|
215 |
35469
f1c54d003327
templater: move repo, ui and cache to per-engine resources
Yuya Nishihara <yuya@tcha.org>
parents:
34993
diff
changeset
|
216 Internal resources shouldn't be exposed (issue5699): |
f1c54d003327
templater: move repo, ui and cache to per-engine resources
Yuya Nishihara <yuya@tcha.org>
parents:
34993
diff
changeset
|
217 |
35470
a33be093ec62
templater: look up symbols/resources as if they were separated (issue5699)
Yuya Nishihara <yuya@tcha.org>
parents:
35469
diff
changeset
|
218 $ hg log -r. -T '{cache}{ctx}{repo}{revcache}{templ}{ui}' |
a33be093ec62
templater: look up symbols/resources as if they were separated (issue5699)
Yuya Nishihara <yuya@tcha.org>
parents:
35469
diff
changeset
|
219 |
a33be093ec62
templater: look up symbols/resources as if they were separated (issue5699)
Yuya Nishihara <yuya@tcha.org>
parents:
35469
diff
changeset
|
220 Never crash on internal resource not available: |
a33be093ec62
templater: look up symbols/resources as if they were separated (issue5699)
Yuya Nishihara <yuya@tcha.org>
parents:
35469
diff
changeset
|
221 |
a33be093ec62
templater: look up symbols/resources as if they were separated (issue5699)
Yuya Nishihara <yuya@tcha.org>
parents:
35469
diff
changeset
|
222 $ hg --cwd .. debugtemplate '{"c0bebeef"|shortest}\n' |
38427
4b73f316ba0e
templatefuncs: minimize resource requirements
Yuya Nishihara <yuya@tcha.org>
parents:
38355
diff
changeset
|
223 abort: template resource not available: repo |
35470
a33be093ec62
templater: look up symbols/resources as if they were separated (issue5699)
Yuya Nishihara <yuya@tcha.org>
parents:
35469
diff
changeset
|
224 [255] |
35469
f1c54d003327
templater: move repo, ui and cache to per-engine resources
Yuya Nishihara <yuya@tcha.org>
parents:
34993
diff
changeset
|
225 |
36445
e8d37838f5df
templatekw: add 'requires' flag to switch to exception-safe interface
Yuya Nishihara <yuya@tcha.org>
parents:
36246
diff
changeset
|
226 $ hg config -T '{author}' |
e8d37838f5df
templatekw: add 'requires' flag to switch to exception-safe interface
Yuya Nishihara <yuya@tcha.org>
parents:
36246
diff
changeset
|
227 |
16678
48b1674ac1e7
templater: handle SyntaxError when parsing ui.logtemplate
Martin Geisler <martin@geisler.net>
parents:
15839
diff
changeset
|
228 Quoting for ui.logtemplate |
48b1674ac1e7
templater: handle SyntaxError when parsing ui.logtemplate
Martin Geisler <martin@geisler.net>
parents:
15839
diff
changeset
|
229 |
48b1674ac1e7
templater: handle SyntaxError when parsing ui.logtemplate
Martin Geisler <martin@geisler.net>
parents:
15839
diff
changeset
|
230 $ hg tip --config "ui.logtemplate={rev}\n" |
48b1674ac1e7
templater: handle SyntaxError when parsing ui.logtemplate
Martin Geisler <martin@geisler.net>
parents:
15839
diff
changeset
|
231 8 |
48b1674ac1e7
templater: handle SyntaxError when parsing ui.logtemplate
Martin Geisler <martin@geisler.net>
parents:
15839
diff
changeset
|
232 $ hg tip --config "ui.logtemplate='{rev}\n'" |
48b1674ac1e7
templater: handle SyntaxError when parsing ui.logtemplate
Martin Geisler <martin@geisler.net>
parents:
15839
diff
changeset
|
233 8 |
48b1674ac1e7
templater: handle SyntaxError when parsing ui.logtemplate
Martin Geisler <martin@geisler.net>
parents:
15839
diff
changeset
|
234 $ hg tip --config 'ui.logtemplate="{rev}\n"' |
48b1674ac1e7
templater: handle SyntaxError when parsing ui.logtemplate
Martin Geisler <martin@geisler.net>
parents:
15839
diff
changeset
|
235 8 |
28687
29c249dfb4ef
templater: do not strip non-quote characters from template config
Yuya Nishihara <yuya@tcha.org>
parents:
28628
diff
changeset
|
236 $ hg tip --config 'ui.logtemplate=n{rev}\n' |
29c249dfb4ef
templater: do not strip non-quote characters from template config
Yuya Nishihara <yuya@tcha.org>
parents:
28628
diff
changeset
|
237 n8 |
16678
48b1674ac1e7
templater: handle SyntaxError when parsing ui.logtemplate
Martin Geisler <martin@geisler.net>
parents:
15839
diff
changeset
|
238 |
27939
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
239 Check that recursive reference does not fall into RuntimeError (issue4758): |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
240 |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
241 common mistake: |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
242 |
32874
dddba6f3e59c
test-command-template: rewrite recursion tests by using a map file
Yuya Nishihara <yuya@tcha.org>
parents:
32684
diff
changeset
|
243 $ cat << EOF > issue4758 |
dddba6f3e59c
test-command-template: rewrite recursion tests by using a map file
Yuya Nishihara <yuya@tcha.org>
parents:
32684
diff
changeset
|
244 > changeset = '{changeset}\n' |
dddba6f3e59c
test-command-template: rewrite recursion tests by using a map file
Yuya Nishihara <yuya@tcha.org>
parents:
32684
diff
changeset
|
245 > EOF |
dddba6f3e59c
test-command-template: rewrite recursion tests by using a map file
Yuya Nishihara <yuya@tcha.org>
parents:
32684
diff
changeset
|
246 $ hg log --style ./issue4758 |
27939
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
247 abort: recursive reference 'changeset' in template |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
248 [255] |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
249 |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
250 circular reference: |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
251 |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
252 $ cat << EOF > issue4758 |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
253 > changeset = '{foo}' |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
254 > foo = '{changeset}' |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
255 > EOF |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
256 $ hg log --style ./issue4758 |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
257 abort: recursive reference 'foo' in template |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
258 [255] |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
259 |
27940
cfe7da66f555
templater: abort if infinite recursion detected while compiling
Yuya Nishihara <yuya@tcha.org>
parents:
27939
diff
changeset
|
260 buildmap() -> gettemplate(), where no thunk was made: |
cfe7da66f555
templater: abort if infinite recursion detected while compiling
Yuya Nishihara <yuya@tcha.org>
parents:
27939
diff
changeset
|
261 |
32874
dddba6f3e59c
test-command-template: rewrite recursion tests by using a map file
Yuya Nishihara <yuya@tcha.org>
parents:
32684
diff
changeset
|
262 $ cat << EOF > issue4758 |
dddba6f3e59c
test-command-template: rewrite recursion tests by using a map file
Yuya Nishihara <yuya@tcha.org>
parents:
32684
diff
changeset
|
263 > changeset = '{files % changeset}\n' |
dddba6f3e59c
test-command-template: rewrite recursion tests by using a map file
Yuya Nishihara <yuya@tcha.org>
parents:
32684
diff
changeset
|
264 > EOF |
dddba6f3e59c
test-command-template: rewrite recursion tests by using a map file
Yuya Nishihara <yuya@tcha.org>
parents:
32684
diff
changeset
|
265 $ hg log --style ./issue4758 |
27940
cfe7da66f555
templater: abort if infinite recursion detected while compiling
Yuya Nishihara <yuya@tcha.org>
parents:
27939
diff
changeset
|
266 abort: recursive reference 'changeset' in template |
cfe7da66f555
templater: abort if infinite recursion detected while compiling
Yuya Nishihara <yuya@tcha.org>
parents:
27939
diff
changeset
|
267 [255] |
cfe7da66f555
templater: abort if infinite recursion detected while compiling
Yuya Nishihara <yuya@tcha.org>
parents:
27939
diff
changeset
|
268 |
27939
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
269 not a recursion if a keyword of the same name exists: |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
270 |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
271 $ cat << EOF > issue4758 |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
272 > changeset = '{tags % rev}' |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
273 > rev = '{rev} {tag}\n' |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
274 > EOF |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
275 $ hg log --style ./issue4758 -r tip |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
276 8 tip |
7ed3a3c0cef1
templater: abort if infinite recursion detected while evaluation (issue4758)
Yuya Nishihara <yuya@tcha.org>
parents:
27894
diff
changeset
|
277 |
38436
da4508cdef37
tests: extract test-template-keywords.t from test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
278 Set up phase: |
22764
1e2f54a149e8
templater: set the correct phase for parents
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
22668
diff
changeset
|
279 |
1e2f54a149e8
templater: set the correct phase for parents
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
22668
diff
changeset
|
280 $ hg phase -r 5 --public |
1e2f54a149e8
templater: set the correct phase for parents
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
22668
diff
changeset
|
281 $ hg phase -r 7 --secret --force |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
282 |
25005
5ddbb024c2e9
tests: fix hidden repeatability problem with age filter test
Matt Mackall <mpm@selenic.com>
parents:
25003
diff
changeset
|
283 Add a dummy commit to make up for the instability of the above: |
5ddbb024c2e9
tests: fix hidden repeatability problem with age filter test
Matt Mackall <mpm@selenic.com>
parents:
25003
diff
changeset
|
284 |
5ddbb024c2e9
tests: fix hidden repeatability problem with age filter test
Matt Mackall <mpm@selenic.com>
parents:
25003
diff
changeset
|
285 $ echo a > a |
5ddbb024c2e9
tests: fix hidden repeatability problem with age filter test
Matt Mackall <mpm@selenic.com>
parents:
25003
diff
changeset
|
286 $ hg add a |
5ddbb024c2e9
tests: fix hidden repeatability problem with age filter test
Matt Mackall <mpm@selenic.com>
parents:
25003
diff
changeset
|
287 $ hg ci -m future |
5ddbb024c2e9
tests: fix hidden repeatability problem with age filter test
Matt Mackall <mpm@selenic.com>
parents:
25003
diff
changeset
|
288 |
24985
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
289 Add a commit that does all possible modifications at once |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
290 |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
291 $ echo modify >> third |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
292 $ touch b |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
293 $ hg add b |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
294 $ hg mv fourth fifth |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
295 $ hg rm a |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
296 $ hg ci -m "Modify, add, remove, rename" |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
297 |
38433
ddce7bdf7f3c
tests: extract test-template-map.t from test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
38427
diff
changeset
|
298 Error on syntax: |
ddce7bdf7f3c
tests: extract test-template-map.t from test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
38427
diff
changeset
|
299 |
ddce7bdf7f3c
tests: extract test-template-map.t from test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
38427
diff
changeset
|
300 $ cat <<EOF > t |
ddce7bdf7f3c
tests: extract test-template-map.t from test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
38427
diff
changeset
|
301 > changeset = '{c}' |
ddce7bdf7f3c
tests: extract test-template-map.t from test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
38427
diff
changeset
|
302 > c = q |
ddce7bdf7f3c
tests: extract test-template-map.t from test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
38427
diff
changeset
|
303 > x = "f |
25006
517763f87141
log: add a status template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
25005
diff
changeset
|
304 > EOF |
38433
ddce7bdf7f3c
tests: extract test-template-map.t from test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
38427
diff
changeset
|
305 $ echo '[ui]' > .hg/hgrc |
ddce7bdf7f3c
tests: extract test-template-map.t from test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
38427
diff
changeset
|
306 $ echo 'style = t' >> .hg/hgrc |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
307 $ hg log |
28628
ed1d90f6e921
templater: do not abuse SyntaxError to report errors in template map file
Yuya Nishihara <yuya@tcha.org>
parents:
28548
diff
changeset
|
308 hg: parse error at t:3: unmatched quotes |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12283
diff
changeset
|
309 [255] |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
310 |
25782
babd2c93bd99
templater: check existence of closing brace of template string
Yuya Nishihara <yuya@tcha.org>
parents:
25762
diff
changeset
|
311 $ hg log -T '{date' |
babd2c93bd99
templater: check existence of closing brace of template string
Yuya Nishihara <yuya@tcha.org>
parents:
25762
diff
changeset
|
312 hg: parse error at 1: unterminated template expansion |
36669
80d7fb6c2dec
templater: add hint to template parse errors to help locate issues
Ryan McElroy <rmcelroy@fb.com>
parents:
36635
diff
changeset
|
313 ({date |
36691
1b179d151578
templater: fix position of terminator character in error message
Yuya Nishihara <yuya@tcha.org>
parents:
36669
diff
changeset
|
314 ^ here) |
25782
babd2c93bd99
templater: check existence of closing brace of template string
Yuya Nishihara <yuya@tcha.org>
parents:
25762
diff
changeset
|
315 [255] |
35680
077ee15b8493
templater: make sure expression is terminated by '}'
Yuya Nishihara <yuya@tcha.org>
parents:
35594
diff
changeset
|
316 $ hg log -T '{date(}' |
36691
1b179d151578
templater: fix position of terminator character in error message
Yuya Nishihara <yuya@tcha.org>
parents:
36669
diff
changeset
|
317 hg: parse error at 6: not a prefix: end |
36669
80d7fb6c2dec
templater: add hint to template parse errors to help locate issues
Ryan McElroy <rmcelroy@fb.com>
parents:
36635
diff
changeset
|
318 ({date(} |
80d7fb6c2dec
templater: add hint to template parse errors to help locate issues
Ryan McElroy <rmcelroy@fb.com>
parents:
36635
diff
changeset
|
319 ^ here) |
35680
077ee15b8493
templater: make sure expression is terminated by '}'
Yuya Nishihara <yuya@tcha.org>
parents:
35594
diff
changeset
|
320 [255] |
077ee15b8493
templater: make sure expression is terminated by '}'
Yuya Nishihara <yuya@tcha.org>
parents:
35594
diff
changeset
|
321 $ hg log -T '{date)}' |
077ee15b8493
templater: make sure expression is terminated by '}'
Yuya Nishihara <yuya@tcha.org>
parents:
35594
diff
changeset
|
322 hg: parse error at 5: invalid token |
36669
80d7fb6c2dec
templater: add hint to template parse errors to help locate issues
Ryan McElroy <rmcelroy@fb.com>
parents:
36635
diff
changeset
|
323 ({date)} |
36691
1b179d151578
templater: fix position of terminator character in error message
Yuya Nishihara <yuya@tcha.org>
parents:
36669
diff
changeset
|
324 ^ here) |
35680
077ee15b8493
templater: make sure expression is terminated by '}'
Yuya Nishihara <yuya@tcha.org>
parents:
35594
diff
changeset
|
325 [255] |
077ee15b8493
templater: make sure expression is terminated by '}'
Yuya Nishihara <yuya@tcha.org>
parents:
35594
diff
changeset
|
326 $ hg log -T '{date date}' |
077ee15b8493
templater: make sure expression is terminated by '}'
Yuya Nishihara <yuya@tcha.org>
parents:
35594
diff
changeset
|
327 hg: parse error at 6: invalid token |
36669
80d7fb6c2dec
templater: add hint to template parse errors to help locate issues
Ryan McElroy <rmcelroy@fb.com>
parents:
36635
diff
changeset
|
328 ({date date} |
36691
1b179d151578
templater: fix position of terminator character in error message
Yuya Nishihara <yuya@tcha.org>
parents:
36669
diff
changeset
|
329 ^ here) |
35680
077ee15b8493
templater: make sure expression is terminated by '}'
Yuya Nishihara <yuya@tcha.org>
parents:
35594
diff
changeset
|
330 [255] |
25782
babd2c93bd99
templater: check existence of closing brace of template string
Yuya Nishihara <yuya@tcha.org>
parents:
25762
diff
changeset
|
331 |
35744
8685192a8733
templater: fix crash by empty group expression
Yuya Nishihara <yuya@tcha.org>
parents:
35680
diff
changeset
|
332 $ hg log -T '{}' |
36691
1b179d151578
templater: fix position of terminator character in error message
Yuya Nishihara <yuya@tcha.org>
parents:
36669
diff
changeset
|
333 hg: parse error at 1: not a prefix: end |
36669
80d7fb6c2dec
templater: add hint to template parse errors to help locate issues
Ryan McElroy <rmcelroy@fb.com>
parents:
36635
diff
changeset
|
334 ({} |
80d7fb6c2dec
templater: add hint to template parse errors to help locate issues
Ryan McElroy <rmcelroy@fb.com>
parents:
36635
diff
changeset
|
335 ^ here) |
35744
8685192a8733
templater: fix crash by empty group expression
Yuya Nishihara <yuya@tcha.org>
parents:
35680
diff
changeset
|
336 [255] |
8685192a8733
templater: fix crash by empty group expression
Yuya Nishihara <yuya@tcha.org>
parents:
35680
diff
changeset
|
337 $ hg debugtemplate -v '{()}' |
8685192a8733
templater: fix crash by empty group expression
Yuya Nishihara <yuya@tcha.org>
parents:
35680
diff
changeset
|
338 (template |
8685192a8733
templater: fix crash by empty group expression
Yuya Nishihara <yuya@tcha.org>
parents:
35680
diff
changeset
|
339 (group |
8685192a8733
templater: fix crash by empty group expression
Yuya Nishihara <yuya@tcha.org>
parents:
35680
diff
changeset
|
340 None)) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
341 * keywords: |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
342 * functions: |
35744
8685192a8733
templater: fix crash by empty group expression
Yuya Nishihara <yuya@tcha.org>
parents:
35680
diff
changeset
|
343 hg: parse error: missing argument |
8685192a8733
templater: fix crash by empty group expression
Yuya Nishihara <yuya@tcha.org>
parents:
35680
diff
changeset
|
344 [255] |
25782
babd2c93bd99
templater: check existence of closing brace of template string
Yuya Nishihara <yuya@tcha.org>
parents:
25762
diff
changeset
|
345 |
37223
08e042f0a67c
templatefilters: declare input type as bytes where appropriate
Yuya Nishihara <yuya@tcha.org>
parents:
37105
diff
changeset
|
346 Behind the scenes, this would throw TypeError without intype=bytes |
17383
099c778ceb33
templater: abort when a template filter raises an exception (issue2987)
Neil Kodner <neilk@fb.com>
parents:
17345
diff
changeset
|
347 |
099c778ceb33
templater: abort when a template filter raises an exception (issue2987)
Neil Kodner <neilk@fb.com>
parents:
17345
diff
changeset
|
348 $ hg log -l 3 --template '{date|obfuscate}\n' |
38299
88e7105b5cd9
templater: restore the original string format of {date}
Yuya Nishihara <yuya@tcha.org>
parents:
38289
diff
changeset
|
349 0.00 |
88e7105b5cd9
templater: restore the original string format of {date}
Yuya Nishihara <yuya@tcha.org>
parents:
38289
diff
changeset
|
350 0.00 |
88e7105b5cd9
templater: restore the original string format of {date}
Yuya Nishihara <yuya@tcha.org>
parents:
38289
diff
changeset
|
351 1577872860.00 |
17383
099c778ceb33
templater: abort when a template filter raises an exception (issue2987)
Neil Kodner <neilk@fb.com>
parents:
17345
diff
changeset
|
352 |
099c778ceb33
templater: abort when a template filter raises an exception (issue2987)
Neil Kodner <neilk@fb.com>
parents:
17345
diff
changeset
|
353 Behind the scenes, this will throw a ValueError |
099c778ceb33
templater: abort when a template filter raises an exception (issue2987)
Neil Kodner <neilk@fb.com>
parents:
17345
diff
changeset
|
354 |
099c778ceb33
templater: abort when a template filter raises an exception (issue2987)
Neil Kodner <neilk@fb.com>
parents:
17345
diff
changeset
|
355 $ hg log -l 3 --template 'line: {desc|shortdate}\n' |
37227
9bcf096a2da2
templatefilters: declare input type as date where appropriate
Yuya Nishihara <yuya@tcha.org>
parents:
37223
diff
changeset
|
356 hg: parse error: invalid date: 'Modify, add, remove, rename' |
9bcf096a2da2
templatefilters: declare input type as date where appropriate
Yuya Nishihara <yuya@tcha.org>
parents:
37223
diff
changeset
|
357 (template filter 'shortdate' is not compatible with keyword 'desc') |
17383
099c778ceb33
templater: abort when a template filter raises an exception (issue2987)
Neil Kodner <neilk@fb.com>
parents:
17345
diff
changeset
|
358 [255] |
099c778ceb33
templater: abort when a template filter raises an exception (issue2987)
Neil Kodner <neilk@fb.com>
parents:
17345
diff
changeset
|
359 |
37223
08e042f0a67c
templatefilters: declare input type as bytes where appropriate
Yuya Nishihara <yuya@tcha.org>
parents:
37105
diff
changeset
|
360 Behind the scenes, this would throw AttributeError without intype=bytes |
17383
099c778ceb33
templater: abort when a template filter raises an exception (issue2987)
Neil Kodner <neilk@fb.com>
parents:
17345
diff
changeset
|
361 |
099c778ceb33
templater: abort when a template filter raises an exception (issue2987)
Neil Kodner <neilk@fb.com>
parents:
17345
diff
changeset
|
362 $ hg log -l 3 --template 'line: {date|escape}\n' |
38299
88e7105b5cd9
templater: restore the original string format of {date}
Yuya Nishihara <yuya@tcha.org>
parents:
38289
diff
changeset
|
363 line: 0.00 |
88e7105b5cd9
templater: restore the original string format of {date}
Yuya Nishihara <yuya@tcha.org>
parents:
38289
diff
changeset
|
364 line: 0.00 |
88e7105b5cd9
templater: restore the original string format of {date}
Yuya Nishihara <yuya@tcha.org>
parents:
38289
diff
changeset
|
365 line: 1577872860.00 |
17383
099c778ceb33
templater: abort when a template filter raises an exception (issue2987)
Neil Kodner <neilk@fb.com>
parents:
17345
diff
changeset
|
366 |
26127
7012be5ab5bd
templater: port localdate filter to a function
Yuya Nishihara <yuya@tcha.org>
parents:
26106
diff
changeset
|
367 $ hg log -l 3 --template 'line: {extras|localdate}\n' |
7012be5ab5bd
templater: port localdate filter to a function
Yuya Nishihara <yuya@tcha.org>
parents:
26106
diff
changeset
|
368 hg: parse error: localdate expects a date information |
7012be5ab5bd
templater: port localdate filter to a function
Yuya Nishihara <yuya@tcha.org>
parents:
26106
diff
changeset
|
369 [255] |
7012be5ab5bd
templater: port localdate filter to a function
Yuya Nishihara <yuya@tcha.org>
parents:
26106
diff
changeset
|
370 |
17383
099c778ceb33
templater: abort when a template filter raises an exception (issue2987)
Neil Kodner <neilk@fb.com>
parents:
17345
diff
changeset
|
371 Behind the scenes, this will throw ValueError |
099c778ceb33
templater: abort when a template filter raises an exception (issue2987)
Neil Kodner <neilk@fb.com>
parents:
17345
diff
changeset
|
372 |
099c778ceb33
templater: abort when a template filter raises an exception (issue2987)
Neil Kodner <neilk@fb.com>
parents:
17345
diff
changeset
|
373 $ hg tip --template '{author|email|date}\n' |
26106
c568c4db036f
templatefilters: remove redundant 'date' and 'strip' filters
Yuya Nishihara <yuya@tcha.org>
parents:
26105
diff
changeset
|
374 hg: parse error: date expects a date information |
17383
099c778ceb33
templater: abort when a template filter raises an exception (issue2987)
Neil Kodner <neilk@fb.com>
parents:
17345
diff
changeset
|
375 [255] |
099c778ceb33
templater: abort when a template filter raises an exception (issue2987)
Neil Kodner <neilk@fb.com>
parents:
17345
diff
changeset
|
376 |
31927
2abc556dbe92
templater: find keyword name more thoroughly on filtering error
Yuya Nishihara <yuya@tcha.org>
parents:
31926
diff
changeset
|
377 $ hg tip -T '{author|email|shortdate}\n' |
37227
9bcf096a2da2
templatefilters: declare input type as date where appropriate
Yuya Nishihara <yuya@tcha.org>
parents:
37223
diff
changeset
|
378 hg: parse error: invalid date: 'test' |
9bcf096a2da2
templatefilters: declare input type as date where appropriate
Yuya Nishihara <yuya@tcha.org>
parents:
37223
diff
changeset
|
379 (template filter 'shortdate' is not compatible with keyword 'author') |
31927
2abc556dbe92
templater: find keyword name more thoroughly on filtering error
Yuya Nishihara <yuya@tcha.org>
parents:
31926
diff
changeset
|
380 [255] |
2abc556dbe92
templater: find keyword name more thoroughly on filtering error
Yuya Nishihara <yuya@tcha.org>
parents:
31926
diff
changeset
|
381 |
2abc556dbe92
templater: find keyword name more thoroughly on filtering error
Yuya Nishihara <yuya@tcha.org>
parents:
31926
diff
changeset
|
382 $ hg tip -T '{get(extras, "branch")|shortdate}\n' |
37227
9bcf096a2da2
templatefilters: declare input type as date where appropriate
Yuya Nishihara <yuya@tcha.org>
parents:
37223
diff
changeset
|
383 hg: parse error: invalid date: 'default' |
9bcf096a2da2
templatefilters: declare input type as date where appropriate
Yuya Nishihara <yuya@tcha.org>
parents:
37223
diff
changeset
|
384 (incompatible use of template filter 'shortdate') |
31927
2abc556dbe92
templater: find keyword name more thoroughly on filtering error
Yuya Nishihara <yuya@tcha.org>
parents:
31926
diff
changeset
|
385 [255] |
2abc556dbe92
templater: find keyword name more thoroughly on filtering error
Yuya Nishihara <yuya@tcha.org>
parents:
31926
diff
changeset
|
386 |
25783
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25782
diff
changeset
|
387 Error in nested template: |
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25782
diff
changeset
|
388 |
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25782
diff
changeset
|
389 $ hg log -T '{"date' |
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25782
diff
changeset
|
390 hg: parse error at 2: unterminated string |
36669
80d7fb6c2dec
templater: add hint to template parse errors to help locate issues
Ryan McElroy <rmcelroy@fb.com>
parents:
36635
diff
changeset
|
391 ({"date |
36691
1b179d151578
templater: fix position of terminator character in error message
Yuya Nishihara <yuya@tcha.org>
parents:
36669
diff
changeset
|
392 ^ here) |
25783
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25782
diff
changeset
|
393 [255] |
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25782
diff
changeset
|
394 |
31885
d18b624c1c06
templater: add parsing rule for key-value pair
Yuya Nishihara <yuya@tcha.org>
parents:
31882
diff
changeset
|
395 $ hg log -T '{"foo{date|?}"}' |
25783
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25782
diff
changeset
|
396 hg: parse error at 11: syntax error |
36669
80d7fb6c2dec
templater: add hint to template parse errors to help locate issues
Ryan McElroy <rmcelroy@fb.com>
parents:
36635
diff
changeset
|
397 ({"foo{date|?}"} |
36691
1b179d151578
templater: fix position of terminator character in error message
Yuya Nishihara <yuya@tcha.org>
parents:
36669
diff
changeset
|
398 ^ here) |
25783
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25782
diff
changeset
|
399 [255] |
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25782
diff
changeset
|
400 |
20857
6eb55310fcbc
templater: raise error for unknown func
Sean Farley <sean.michael.farley@gmail.com>
parents:
20663
diff
changeset
|
401 Thrown an error if a template function doesn't exist |
6eb55310fcbc
templater: raise error for unknown func
Sean Farley <sean.michael.farley@gmail.com>
parents:
20663
diff
changeset
|
402 |
6eb55310fcbc
templater: raise error for unknown func
Sean Farley <sean.michael.farley@gmail.com>
parents:
20663
diff
changeset
|
403 $ hg tip --template '{foo()}\n' |
6eb55310fcbc
templater: raise error for unknown func
Sean Farley <sean.michael.farley@gmail.com>
parents:
20663
diff
changeset
|
404 hg: parse error: unknown function 'foo' |
6eb55310fcbc
templater: raise error for unknown func
Sean Farley <sean.michael.farley@gmail.com>
parents:
20663
diff
changeset
|
405 [255] |
6eb55310fcbc
templater: raise error for unknown func
Sean Farley <sean.michael.farley@gmail.com>
parents:
20663
diff
changeset
|
406 |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
407 $ cd .. |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
408 |
38436
da4508cdef37
tests: extract test-template-keywords.t from test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
409 Set up latesttag repository: |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
410 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
411 $ hg init latesttag |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
412 $ cd latesttag |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
413 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
414 $ echo a > file |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
415 $ hg ci -Am a -d '0 0' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
416 adding file |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
417 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
418 $ echo b >> file |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
419 $ hg ci -m b -d '1 0' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
420 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
421 $ echo c >> head1 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
422 $ hg ci -Am h1c -d '2 0' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
423 adding head1 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
424 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
425 $ hg update -q 1 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
426 $ echo d >> head2 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
427 $ hg ci -Am h2d -d '3 0' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
428 adding head2 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
429 created new head |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
430 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
431 $ echo e >> head2 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
432 $ hg ci -m h2e -d '4 0' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
433 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
434 $ hg merge -q |
19989
c38c3fdc8b93
date: allow %z in format (issue4040)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
435 $ hg ci -m merge -d '5 -3600' |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
436 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
437 $ hg tag -r 1 -m t1 -d '6 0' t1 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
438 $ hg tag -r 2 -m t2 -d '7 0' t2 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
439 $ hg tag -r 3 -m t3 -d '8 0' t3 |
33862
fb672eac2702
templatekw: choose {latesttag} by len(changes), not date (issue5659)
Martin von Zweigbergk <martinvonz@google.com>
parents:
33861
diff
changeset
|
440 $ hg tag -r 4 -m t4 -d '4 0' t4 # older than t2, but should not matter |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
441 $ hg tag -r 5 -m t5 -d '9 0' t5 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
442 $ hg tag -r 3 -m at3 -d '10 0' at3 |
33861
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
443 |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
444 $ cd .. |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
445 |
17631
0b241d7a8c62
templating: make new-style templating features work with command line lists
Matt Mackall <mpm@selenic.com>
parents:
17387
diff
changeset
|
446 Test new-style inline templating: |
0b241d7a8c62
templating: make new-style templating features work with command line lists
Matt Mackall <mpm@selenic.com>
parents:
17387
diff
changeset
|
447 |
0b241d7a8c62
templating: make new-style templating features work with command line lists
Matt Mackall <mpm@selenic.com>
parents:
17387
diff
changeset
|
448 $ hg log -R latesttag -r tip --template 'modified files: {file_mods % " {file}\n"}\n' |
0b241d7a8c62
templating: make new-style templating features work with command line lists
Matt Mackall <mpm@selenic.com>
parents:
17387
diff
changeset
|
449 modified files: .hgtags |
0b241d7a8c62
templating: make new-style templating features work with command line lists
Matt Mackall <mpm@selenic.com>
parents:
17387
diff
changeset
|
450 |
28349
7cb2f2438f85
templater: handle exception when applying map operator to non-iterable object
Yuya Nishihara <yuya@tcha.org>
parents:
28346
diff
changeset
|
451 |
7cb2f2438f85
templater: handle exception when applying map operator to non-iterable object
Yuya Nishihara <yuya@tcha.org>
parents:
28346
diff
changeset
|
452 $ hg log -R latesttag -r tip -T '{rev % "a"}\n' |
38229
7701c2d4a438
templater: always map over a wrapped object
Yuya Nishihara <yuya@tcha.org>
parents:
38228
diff
changeset
|
453 hg: parse error: 11 is not iterable of mappings |
38271
4b0f39e7406e
templater: show slightly better hint on map operation error
Yuya Nishihara <yuya@tcha.org>
parents:
38267
diff
changeset
|
454 (keyword 'rev' does not support map operation) |
28349
7cb2f2438f85
templater: handle exception when applying map operator to non-iterable object
Yuya Nishihara <yuya@tcha.org>
parents:
28346
diff
changeset
|
455 [255] |
7cb2f2438f85
templater: handle exception when applying map operator to non-iterable object
Yuya Nishihara <yuya@tcha.org>
parents:
28346
diff
changeset
|
456 $ hg log -R latesttag -r tip -T '{get(extras, "unknown") % "a"}\n' |
37404
7c902a8345ef
templater: complain about invalid application of '%' operator (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
37229
diff
changeset
|
457 hg: parse error: None is not iterable of mappings |
7c902a8345ef
templater: complain about invalid application of '%' operator (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
37229
diff
changeset
|
458 [255] |
7c902a8345ef
templater: complain about invalid application of '%' operator (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
37229
diff
changeset
|
459 $ hg log -R latesttag -r tip -T '{extras % "{key}\n" % "{key}\n"}' |
37499
75c13343cf38
templater: wrap result of '%' operation so it never looks like a thunk
Yuya Nishihara <yuya@tcha.org>
parents:
37418
diff
changeset
|
460 hg: parse error: list of strings is not mappable |
28349
7cb2f2438f85
templater: handle exception when applying map operator to non-iterable object
Yuya Nishihara <yuya@tcha.org>
parents:
28346
diff
changeset
|
461 [255] |
7cb2f2438f85
templater: handle exception when applying map operator to non-iterable object
Yuya Nishihara <yuya@tcha.org>
parents:
28346
diff
changeset
|
462 |
34330
89aec1834a86
templatekw: add new-style template expansion to {manifest}
Yuya Nishihara <yuya@tcha.org>
parents:
34329
diff
changeset
|
463 Test new-style inline templating of non-list/dict type: |
89aec1834a86
templatekw: add new-style template expansion to {manifest}
Yuya Nishihara <yuya@tcha.org>
parents:
34329
diff
changeset
|
464 |
89aec1834a86
templatekw: add new-style template expansion to {manifest}
Yuya Nishihara <yuya@tcha.org>
parents:
34329
diff
changeset
|
465 $ hg log -R latesttag -r tip -T '{manifest}\n' |
89aec1834a86
templatekw: add new-style template expansion to {manifest}
Yuya Nishihara <yuya@tcha.org>
parents:
34329
diff
changeset
|
466 11:2bc6e9006ce2 |
89aec1834a86
templatekw: add new-style template expansion to {manifest}
Yuya Nishihara <yuya@tcha.org>
parents:
34329
diff
changeset
|
467 $ hg log -R latesttag -r tip -T 'string length: {manifest|count}\n' |
89aec1834a86
templatekw: add new-style template expansion to {manifest}
Yuya Nishihara <yuya@tcha.org>
parents:
34329
diff
changeset
|
468 string length: 15 |
89aec1834a86
templatekw: add new-style template expansion to {manifest}
Yuya Nishihara <yuya@tcha.org>
parents:
34329
diff
changeset
|
469 $ hg log -R latesttag -r tip -T '{manifest % "{rev}:{node}"}\n' |
89aec1834a86
templatekw: add new-style template expansion to {manifest}
Yuya Nishihara <yuya@tcha.org>
parents:
34329
diff
changeset
|
470 11:2bc6e9006ce29882383a22d39fd1f4e66dd3e2fc |
89aec1834a86
templatekw: add new-style template expansion to {manifest}
Yuya Nishihara <yuya@tcha.org>
parents:
34329
diff
changeset
|
471 |
34534
b3073e175c17
templater: wrap get/min/max result so map operation can apply to element
Yuya Nishihara <yuya@tcha.org>
parents:
34330
diff
changeset
|
472 $ hg log -R latesttag -r tip -T '{get(extras, "branch") % "{key}: {value}\n"}' |
b3073e175c17
templater: wrap get/min/max result so map operation can apply to element
Yuya Nishihara <yuya@tcha.org>
parents:
34330
diff
changeset
|
473 branch: default |
b3073e175c17
templater: wrap get/min/max result so map operation can apply to element
Yuya Nishihara <yuya@tcha.org>
parents:
34330
diff
changeset
|
474 $ hg log -R latesttag -r tip -T '{get(extras, "unknown") % "{key}\n"}' |
37404
7c902a8345ef
templater: complain about invalid application of '%' operator (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
37229
diff
changeset
|
475 hg: parse error: None is not iterable of mappings |
34534
b3073e175c17
templater: wrap get/min/max result so map operation can apply to element
Yuya Nishihara <yuya@tcha.org>
parents:
34330
diff
changeset
|
476 [255] |
b3073e175c17
templater: wrap get/min/max result so map operation can apply to element
Yuya Nishihara <yuya@tcha.org>
parents:
34330
diff
changeset
|
477 $ hg log -R latesttag -r tip -T '{min(extras) % "{key}: {value}\n"}' |
b3073e175c17
templater: wrap get/min/max result so map operation can apply to element
Yuya Nishihara <yuya@tcha.org>
parents:
34330
diff
changeset
|
478 branch: default |
b3073e175c17
templater: wrap get/min/max result so map operation can apply to element
Yuya Nishihara <yuya@tcha.org>
parents:
34330
diff
changeset
|
479 $ hg log -R latesttag -l1 -T '{min(revset("0:9")) % "{rev}:{node|short}\n"}' |
b3073e175c17
templater: wrap get/min/max result so map operation can apply to element
Yuya Nishihara <yuya@tcha.org>
parents:
34330
diff
changeset
|
480 0:ce3cec86e6c2 |
b3073e175c17
templater: wrap get/min/max result so map operation can apply to element
Yuya Nishihara <yuya@tcha.org>
parents:
34330
diff
changeset
|
481 $ hg log -R latesttag -l1 -T '{max(revset("0:9")) % "{rev}:{node|short}\n"}' |
b3073e175c17
templater: wrap get/min/max result so map operation can apply to element
Yuya Nishihara <yuya@tcha.org>
parents:
34330
diff
changeset
|
482 9:fbc7cd862e9c |
b3073e175c17
templater: wrap get/min/max result so map operation can apply to element
Yuya Nishihara <yuya@tcha.org>
parents:
34330
diff
changeset
|
483 |
34535
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
484 Test dot operator precedence: |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
485 |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
486 $ hg debugtemplate -R latesttag -r0 -v '{manifest.node|short}\n' |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
487 (template |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
488 (| |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
489 (. |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
490 (symbol 'manifest') |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
491 (symbol 'node')) |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
492 (symbol 'short')) |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
493 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
494 * keywords: manifest, node, rev |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
495 * functions: formatnode, short |
34535
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
496 89f4071fec70 |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
497 |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
498 (the following examples are invalid, but seem natural in parsing POV) |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
499 |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
500 $ hg debugtemplate -R latesttag -r0 -v '{foo|bar.baz}\n' 2> /dev/null |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
501 (template |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
502 (| |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
503 (symbol 'foo') |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
504 (. |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
505 (symbol 'bar') |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
506 (symbol 'baz'))) |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
507 (string '\n')) |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
508 [255] |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
509 $ hg debugtemplate -R latesttag -r0 -v '{foo.bar()}\n' 2> /dev/null |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
510 (template |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
511 (. |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
512 (symbol 'foo') |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
513 (func |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
514 (symbol 'bar') |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
515 None)) |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
516 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
517 * keywords: foo |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
518 * functions: bar |
34535
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
519 [255] |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
520 |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
521 Test evaluation of dot operator: |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
522 |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
523 $ hg log -R latesttag -l1 -T '{min(revset("0:9")).node}\n' |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
524 ce3cec86e6c26bd9bdfc590a6b92abc9680f1796 |
34536
4c1cfe54c08d
templater: extend dot operator as a short for get(dict, key)
Yuya Nishihara <yuya@tcha.org>
parents:
34535
diff
changeset
|
525 $ hg log -R latesttag -r0 -T '{extras.branch}\n' |
4c1cfe54c08d
templater: extend dot operator as a short for get(dict, key)
Yuya Nishihara <yuya@tcha.org>
parents:
34535
diff
changeset
|
526 default |
38286
851fc9d42d6d
templater: make date wrapper support dot/map operations
Yuya Nishihara <yuya@tcha.org>
parents:
38285
diff
changeset
|
527 $ hg log -R latesttag -r0 -T '{date.unixtime} {localdate(date, "+0200").tzoffset}\n' |
851fc9d42d6d
templater: make date wrapper support dot/map operations
Yuya Nishihara <yuya@tcha.org>
parents:
38285
diff
changeset
|
528 0 -7200 |
34535
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
529 |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
530 $ hg log -R latesttag -l1 -T '{author.invalid}\n' |
38243
06d11cd90516
templater: promote getmember() to an interface of wrapped types
Yuya Nishihara <yuya@tcha.org>
parents:
38229
diff
changeset
|
531 hg: parse error: 'test' is not a dictionary |
06d11cd90516
templater: promote getmember() to an interface of wrapped types
Yuya Nishihara <yuya@tcha.org>
parents:
38229
diff
changeset
|
532 (keyword 'author' does not support member operation) |
34535
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
533 [255] |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
534 $ hg log -R latesttag -l1 -T '{min("abc").invalid}\n' |
38243
06d11cd90516
templater: promote getmember() to an interface of wrapped types
Yuya Nishihara <yuya@tcha.org>
parents:
38229
diff
changeset
|
535 hg: parse error: 'a' is not a dictionary |
34535
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
536 [255] |
78590585c0db
templater: add dot operator to easily access a sub item
Yuya Nishihara <yuya@tcha.org>
parents:
34534
diff
changeset
|
537 |
25002
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
538 Test integer literal: |
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
539 |
28548
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
540 $ hg debugtemplate -v '{(0)}\n' |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
541 (template |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
542 (group |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
543 (integer '0')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
544 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
545 * keywords: |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
546 * functions: |
25002
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
547 0 |
28548
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
548 $ hg debugtemplate -v '{(123)}\n' |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
549 (template |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
550 (group |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
551 (integer '123')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
552 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
553 * keywords: |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
554 * functions: |
25002
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
555 123 |
28548
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
556 $ hg debugtemplate -v '{(-4)}\n' |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
557 (template |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
558 (group |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
559 (negate |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
560 (integer '4'))) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
561 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
562 * keywords: |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
563 * functions: |
25002
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
564 -4 |
28548
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
565 $ hg debugtemplate '{(-)}\n' |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
566 hg: parse error at 3: not a prefix: ) |
36669
80d7fb6c2dec
templater: add hint to template parse errors to help locate issues
Ryan McElroy <rmcelroy@fb.com>
parents:
36635
diff
changeset
|
567 ({(-)}\n |
36691
1b179d151578
templater: fix position of terminator character in error message
Yuya Nishihara <yuya@tcha.org>
parents:
36669
diff
changeset
|
568 ^ here) |
25002
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
569 [255] |
28548
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
570 $ hg debugtemplate '{(-a)}\n' |
30115
8e42dfde93d1
templater: provide arithmetic operations on integers
Simon Farnsworth <simonfar@fb.com>
parents:
30088
diff
changeset
|
571 hg: parse error: negation needs an integer argument |
25002
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
572 [255] |
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
573 |
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
574 top-level integer literal is interpreted as symbol (i.e. variable name): |
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
575 |
28548
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
576 $ hg debugtemplate -D 1=one -v '{1}\n' |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
577 (template |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
578 (integer '1') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
579 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
580 * keywords: |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
581 * functions: |
28548
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
582 one |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
583 $ hg debugtemplate -D 1=one -v '{if("t", "{1}")}\n' |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
584 (template |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
585 (func |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
586 (symbol 'if') |
28548
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
587 (list |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
588 (string 't') |
28548
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
589 (template |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
590 (integer '1')))) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
591 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
592 * keywords: |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
593 * functions: if |
28548
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
594 one |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
595 $ hg debugtemplate -D 1=one -v '{1|stringify}\n' |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
596 (template |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
597 (| |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
598 (integer '1') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
599 (symbol 'stringify')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
600 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
601 * keywords: |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
602 * functions: stringify |
28548
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
603 one |
25002
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
604 |
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
605 unless explicit symbol is expected: |
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
606 |
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
607 $ hg log -Ra -r0 -T '{desc|1}\n' |
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
608 hg: parse error: expected a symbol, got 'integer' |
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
609 [255] |
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
610 $ hg log -Ra -r0 -T '{1()}\n' |
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
611 hg: parse error: expected a symbol, got 'integer' |
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
612 [255] |
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
613 |
25596
c1975809a6b5
templater: take any string literals as template, but not for rawstring (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
25580
diff
changeset
|
614 Test string literal: |
c1975809a6b5
templater: take any string literals as template, but not for rawstring (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
25580
diff
changeset
|
615 |
28548
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
616 $ hg debugtemplate -Ra -r0 -v '{"string with no template fragment"}\n' |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
617 (template |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
618 (string 'string with no template fragment') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
619 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
620 * keywords: |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
621 * functions: |
25596
c1975809a6b5
templater: take any string literals as template, but not for rawstring (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
25580
diff
changeset
|
622 string with no template fragment |
28548
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
623 $ hg debugtemplate -Ra -r0 -v '{"template: {rev}"}\n' |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
624 (template |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
625 (template |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
626 (string 'template: ') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
627 (symbol 'rev')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
628 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
629 * keywords: rev |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
630 * functions: |
25596
c1975809a6b5
templater: take any string literals as template, but not for rawstring (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
25580
diff
changeset
|
631 template: 0 |
28548
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
632 $ hg debugtemplate -Ra -r0 -v '{r"rawstring: {rev}"}\n' |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
633 (template |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
634 (string 'rawstring: {rev}') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
635 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
636 * keywords: |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
637 * functions: |
25596
c1975809a6b5
templater: take any string literals as template, but not for rawstring (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
25580
diff
changeset
|
638 rawstring: {rev} |
28548
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
639 $ hg debugtemplate -Ra -r0 -v '{files % r"rawstring: {file}"}\n' |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
640 (template |
b7a31068cc80
templater: add debugtemplate command
Yuya Nishihara <yuya@tcha.org>
parents:
28546
diff
changeset
|
641 (% |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
642 (symbol 'files') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
643 (string 'rawstring: {file}')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
644 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
645 * keywords: files |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
646 * functions: |
28546
1987ed32efca
templater: relax type of mapped template
Yuya Nishihara <yuya@tcha.org>
parents:
28374
diff
changeset
|
647 rawstring: {file} |
25597
fd5bc660c9f0
templater: do not reevaluate rawstring as template (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
25596
diff
changeset
|
648 |
20066
64b4f0cd7336
templater: fix escaping in nested string literals (issue4102)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
649 Test string escaping: |
64b4f0cd7336
templater: fix escaping in nested string literals (issue4102)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
650 |
64b4f0cd7336
templater: fix escaping in nested string literals (issue4102)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
651 $ hg log -R latesttag -r 0 --template '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n' |
64b4f0cd7336
templater: fix escaping in nested string literals (issue4102)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
652 > |
64b4f0cd7336
templater: fix escaping in nested string literals (issue4102)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
653 <>\n<[> |
64b4f0cd7336
templater: fix escaping in nested string literals (issue4102)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
654 <>\n<]> |
64b4f0cd7336
templater: fix escaping in nested string literals (issue4102)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
655 <>\n< |
20067
3d8bfe2ecf6d
templater: only recursively evaluate string literals as templates (issue4103)
Matt Mackall <mpm@selenic.com>
parents:
20066
diff
changeset
|
656 |
24948
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
657 $ hg log -R latesttag -r 0 \ |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
658 > --config ui.logtemplate='>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n' |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
659 > |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
660 <>\n<[> |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
661 <>\n<]> |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
662 <>\n< |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
663 |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
664 $ hg log -R latesttag -r 0 -T esc \ |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
665 > --config templates.esc='>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n' |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
666 > |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
667 <>\n<[> |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
668 <>\n<]> |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
669 <>\n< |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
670 |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
671 $ cat <<'EOF' > esctmpl |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
672 > changeset = '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n' |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
673 > EOF |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
674 $ hg log -R latesttag -r 0 --style ./esctmpl |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
675 > |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
676 <>\n<[> |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
677 <>\n<]> |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
678 <>\n< |
db7463aa080f
templater: do not process \-escapes at parsestring() (issue4290)
Yuya Nishihara <yuya@tcha.org>
parents:
24903
diff
changeset
|
679 |
25638
6047b60cdd09
templater: fix handling of \-escapes in raw string literals
Yuya Nishihara <yuya@tcha.org>
parents:
25637
diff
changeset
|
680 Test string escaping of quotes: |
6047b60cdd09
templater: fix handling of \-escapes in raw string literals
Yuya Nishihara <yuya@tcha.org>
parents:
25637
diff
changeset
|
681 |
6047b60cdd09
templater: fix handling of \-escapes in raw string literals
Yuya Nishihara <yuya@tcha.org>
parents:
25637
diff
changeset
|
682 $ hg log -Ra -r0 -T '{"\""}\n' |
6047b60cdd09
templater: fix handling of \-escapes in raw string literals
Yuya Nishihara <yuya@tcha.org>
parents:
25637
diff
changeset
|
683 " |
6047b60cdd09
templater: fix handling of \-escapes in raw string literals
Yuya Nishihara <yuya@tcha.org>
parents:
25637
diff
changeset
|
684 $ hg log -Ra -r0 -T '{"\\\""}\n' |
6047b60cdd09
templater: fix handling of \-escapes in raw string literals
Yuya Nishihara <yuya@tcha.org>
parents:
25637
diff
changeset
|
685 \" |
6047b60cdd09
templater: fix handling of \-escapes in raw string literals
Yuya Nishihara <yuya@tcha.org>
parents:
25637
diff
changeset
|
686 $ hg log -Ra -r0 -T '{r"\""}\n' |
6047b60cdd09
templater: fix handling of \-escapes in raw string literals
Yuya Nishihara <yuya@tcha.org>
parents:
25637
diff
changeset
|
687 \" |
6047b60cdd09
templater: fix handling of \-escapes in raw string literals
Yuya Nishihara <yuya@tcha.org>
parents:
25637
diff
changeset
|
688 $ hg log -Ra -r0 -T '{r"\\\""}\n' |
6047b60cdd09
templater: fix handling of \-escapes in raw string literals
Yuya Nishihara <yuya@tcha.org>
parents:
25637
diff
changeset
|
689 \\\" |
6047b60cdd09
templater: fix handling of \-escapes in raw string literals
Yuya Nishihara <yuya@tcha.org>
parents:
25637
diff
changeset
|
690 |
25695 | 691 |
692 $ hg log -Ra -r0 -T '{"\""}\n' | |
693 " | |
694 $ hg log -Ra -r0 -T '{"\\\""}\n' | |
695 \" | |
696 $ hg log -Ra -r0 -T '{r"\""}\n' | |
697 \" | |
698 $ hg log -Ra -r0 -T '{r"\\\""}\n' | |
699 \\\" | |
700 | |
24966
554d6fcc3c84
templater: strip single backslash before quotation mark in quoted template
Yuya Nishihara <yuya@tcha.org>
parents:
24951
diff
changeset
|
701 Test exception in quoted template. single backslash before quotation mark is |
554d6fcc3c84
templater: strip single backslash before quotation mark in quoted template
Yuya Nishihara <yuya@tcha.org>
parents:
24951
diff
changeset
|
702 stripped before parsing: |
554d6fcc3c84
templater: strip single backslash before quotation mark in quoted template
Yuya Nishihara <yuya@tcha.org>
parents:
24951
diff
changeset
|
703 |
554d6fcc3c84
templater: strip single backslash before quotation mark in quoted template
Yuya Nishihara <yuya@tcha.org>
parents:
24951
diff
changeset
|
704 $ cat <<'EOF' > escquotetmpl |
554d6fcc3c84
templater: strip single backslash before quotation mark in quoted template
Yuya Nishihara <yuya@tcha.org>
parents:
24951
diff
changeset
|
705 > changeset = "\" \\" \\\" \\\\" {files % \"{file}\"}\n" |
554d6fcc3c84
templater: strip single backslash before quotation mark in quoted template
Yuya Nishihara <yuya@tcha.org>
parents:
24951
diff
changeset
|
706 > EOF |
554d6fcc3c84
templater: strip single backslash before quotation mark in quoted template
Yuya Nishihara <yuya@tcha.org>
parents:
24951
diff
changeset
|
707 $ cd latesttag |
554d6fcc3c84
templater: strip single backslash before quotation mark in quoted template
Yuya Nishihara <yuya@tcha.org>
parents:
24951
diff
changeset
|
708 $ hg log -r 2 --style ../escquotetmpl |
554d6fcc3c84
templater: strip single backslash before quotation mark in quoted template
Yuya Nishihara <yuya@tcha.org>
parents:
24951
diff
changeset
|
709 " \" \" \\" head1 |
554d6fcc3c84
templater: strip single backslash before quotation mark in quoted template
Yuya Nishihara <yuya@tcha.org>
parents:
24951
diff
changeset
|
710 |
554d6fcc3c84
templater: strip single backslash before quotation mark in quoted template
Yuya Nishihara <yuya@tcha.org>
parents:
24951
diff
changeset
|
711 $ hg log -r 2 -T esc --config templates.esc='"{\"valid\"}\n"' |
554d6fcc3c84
templater: strip single backslash before quotation mark in quoted template
Yuya Nishihara <yuya@tcha.org>
parents:
24951
diff
changeset
|
712 valid |
554d6fcc3c84
templater: strip single backslash before quotation mark in quoted template
Yuya Nishihara <yuya@tcha.org>
parents:
24951
diff
changeset
|
713 $ hg log -r 2 -T esc --config templates.esc="'"'{\'"'"'valid\'"'"'}\n'"'" |
554d6fcc3c84
templater: strip single backslash before quotation mark in quoted template
Yuya Nishihara <yuya@tcha.org>
parents:
24951
diff
changeset
|
714 valid |
25695 | 715 |
25676
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
716 Test compatibility with 2.9.2-3.4 of escaped quoted strings in nested |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
717 _evalifliteral() templates (issue4733): |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
718 |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
719 $ hg log -r 2 -T '{if(rev, "\"{rev}")}\n' |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
720 "2 |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
721 $ hg log -r 2 -T '{if(rev, "{if(rev, \"\\\"{rev}\")}")}\n' |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
722 "2 |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
723 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, \\\"\\\\\\\"{rev}\\\")}\")}")}\n' |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
724 "2 |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
725 |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
726 $ hg log -r 2 -T '{if(rev, "\\\"")}\n' |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
727 \" |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
728 $ hg log -r 2 -T '{if(rev, "{if(rev, \"\\\\\\\"\")}")}\n' |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
729 \" |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
730 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, \\\"\\\\\\\\\\\\\\\"\\\")}\")}")}\n' |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
731 \" |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
732 |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
733 $ hg log -r 2 -T '{if(rev, r"\\\"")}\n' |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
734 \\\" |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
735 $ hg log -r 2 -T '{if(rev, "{if(rev, r\"\\\\\\\"\")}")}\n' |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
736 \\\" |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
737 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, r\\\"\\\\\\\\\\\\\\\"\\\")}\")}")}\n' |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
738 \\\" |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
739 |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
740 escaped single quotes and errors: |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
741 |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
742 $ hg log -r 2 -T "{if(rev, '{if(rev, \'foo\')}')}"'\n' |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
743 foo |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
744 $ hg log -r 2 -T "{if(rev, '{if(rev, r\'foo\')}')}"'\n' |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
745 foo |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
746 $ hg log -r 2 -T '{if(rev, "{if(rev, \")}")}\n' |
25783
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25782
diff
changeset
|
747 hg: parse error at 21: unterminated string |
36669
80d7fb6c2dec
templater: add hint to template parse errors to help locate issues
Ryan McElroy <rmcelroy@fb.com>
parents:
36635
diff
changeset
|
748 ({if(rev, "{if(rev, \")}")}\n |
36691
1b179d151578
templater: fix position of terminator character in error message
Yuya Nishihara <yuya@tcha.org>
parents:
36669
diff
changeset
|
749 ^ here) |
25676
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
750 [255] |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
751 $ hg log -r 2 -T '{if(rev, \"\\"")}\n' |
26215
72aad184f061
templater: create string unescape helper (issue4798)
Matt Mackall <mpm@selenic.com>
parents:
26188
diff
changeset
|
752 hg: parse error: trailing \ in string |
25676
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
753 [255] |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
754 $ hg log -r 2 -T '{if(rev, r\"\\"")}\n' |
26215
72aad184f061
templater: create string unescape helper (issue4798)
Matt Mackall <mpm@selenic.com>
parents:
26188
diff
changeset
|
755 hg: parse error: trailing \ in string |
25676
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
756 [255] |
ec9c258e666d
templater: parse \"...\" as string for 2.9.2-3.4 compatibility (issue4733)
Yuya Nishihara <yuya@tcha.org>
parents:
25638
diff
changeset
|
757 |
24966
554d6fcc3c84
templater: strip single backslash before quotation mark in quoted template
Yuya Nishihara <yuya@tcha.org>
parents:
24951
diff
changeset
|
758 $ cd .. |
554d6fcc3c84
templater: strip single backslash before quotation mark in quoted template
Yuya Nishihara <yuya@tcha.org>
parents:
24951
diff
changeset
|
759 |
24949
890845af1ac2
templater: strictly parse leading backslashes of '{' (issue4569) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24948
diff
changeset
|
760 Test leading backslashes: |
890845af1ac2
templater: strictly parse leading backslashes of '{' (issue4569) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24948
diff
changeset
|
761 |
890845af1ac2
templater: strictly parse leading backslashes of '{' (issue4569) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24948
diff
changeset
|
762 $ cd latesttag |
25597
fd5bc660c9f0
templater: do not reevaluate rawstring as template (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
25596
diff
changeset
|
763 $ hg log -r 2 -T '\{rev} {files % "\{file}"}\n' |
fd5bc660c9f0
templater: do not reevaluate rawstring as template (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
25596
diff
changeset
|
764 {rev} {file} |
fd5bc660c9f0
templater: do not reevaluate rawstring as template (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
25596
diff
changeset
|
765 $ hg log -r 2 -T '\\{rev} {files % "\\{file}"}\n' |
fd5bc660c9f0
templater: do not reevaluate rawstring as template (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
25596
diff
changeset
|
766 \2 \head1 |
fd5bc660c9f0
templater: do not reevaluate rawstring as template (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
25596
diff
changeset
|
767 $ hg log -r 2 -T '\\\{rev} {files % "\\\{file}"}\n' |
fd5bc660c9f0
templater: do not reevaluate rawstring as template (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
25596
diff
changeset
|
768 \{rev} \{file} |
24949
890845af1ac2
templater: strictly parse leading backslashes of '{' (issue4569) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24948
diff
changeset
|
769 $ cd .. |
890845af1ac2
templater: strictly parse leading backslashes of '{' (issue4569) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24948
diff
changeset
|
770 |
25471
7298da81f5a9
templater: do not preprocess template string in "if" expression (issue4714)
Yuya Nishihara <yuya@tcha.org>
parents:
24949
diff
changeset
|
771 Test leading backslashes in "if" expression (issue4714): |
7298da81f5a9
templater: do not preprocess template string in "if" expression (issue4714)
Yuya Nishihara <yuya@tcha.org>
parents:
24949
diff
changeset
|
772 |
7298da81f5a9
templater: do not preprocess template string in "if" expression (issue4714)
Yuya Nishihara <yuya@tcha.org>
parents:
24949
diff
changeset
|
773 $ cd latesttag |
7298da81f5a9
templater: do not preprocess template string in "if" expression (issue4714)
Yuya Nishihara <yuya@tcha.org>
parents:
24949
diff
changeset
|
774 $ hg log -r 2 -T '{if("1", "\{rev}")} {if("1", r"\{rev}")}\n' |
25597
fd5bc660c9f0
templater: do not reevaluate rawstring as template (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
25596
diff
changeset
|
775 {rev} \{rev} |
25471
7298da81f5a9
templater: do not preprocess template string in "if" expression (issue4714)
Yuya Nishihara <yuya@tcha.org>
parents:
24949
diff
changeset
|
776 $ hg log -r 2 -T '{if("1", "\\{rev}")} {if("1", r"\\{rev}")}\n' |
25597
fd5bc660c9f0
templater: do not reevaluate rawstring as template (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
25596
diff
changeset
|
777 \2 \\{rev} |
25471
7298da81f5a9
templater: do not preprocess template string in "if" expression (issue4714)
Yuya Nishihara <yuya@tcha.org>
parents:
24949
diff
changeset
|
778 $ hg log -r 2 -T '{if("1", "\\\{rev}")} {if("1", r"\\\{rev}")}\n' |
25597
fd5bc660c9f0
templater: do not reevaluate rawstring as template (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
25596
diff
changeset
|
779 \{rev} \\\{rev} |
25471
7298da81f5a9
templater: do not preprocess template string in "if" expression (issue4714)
Yuya Nishihara <yuya@tcha.org>
parents:
24949
diff
changeset
|
780 $ cd .. |
7298da81f5a9
templater: do not preprocess template string in "if" expression (issue4714)
Yuya Nishihara <yuya@tcha.org>
parents:
24949
diff
changeset
|
781 |
20663
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
782 "string-escape"-ed "\x5c\x786e" becomes r"\x6e" (once) or r"n" (twice) |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
783 |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
784 $ hg log -R a -r 0 --template '{if("1", "\x5c\x786e", "NG")}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
785 \x6e |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
786 $ hg log -R a -r 0 --template '{if("1", r"\x5c\x786e", "NG")}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
787 \x5c\x786e |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
788 $ hg log -R a -r 0 --template '{if("", "NG", "\x5c\x786e")}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
789 \x6e |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
790 $ hg log -R a -r 0 --template '{if("", "NG", r"\x5c\x786e")}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
791 \x5c\x786e |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
792 |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
793 $ hg log -R a -r 2 --template '{ifeq("no perso\x6e", desc, "\x5c\x786e", "NG")}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
794 \x6e |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
795 $ hg log -R a -r 2 --template '{ifeq(r"no perso\x6e", desc, "NG", r"\x5c\x786e")}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
796 \x5c\x786e |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
797 $ hg log -R a -r 2 --template '{ifeq(desc, "no perso\x6e", "\x5c\x786e", "NG")}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
798 \x6e |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
799 $ hg log -R a -r 2 --template '{ifeq(desc, r"no perso\x6e", "NG", r"\x5c\x786e")}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
800 \x5c\x786e |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
801 |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
802 $ hg log -R a -r 8 --template '{join(files, "\n")}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
803 fourth |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
804 second |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
805 third |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
806 $ hg log -R a -r 8 --template '{join(files, r"\n")}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
807 fourth\nsecond\nthird |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
808 |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
809 $ hg log -R a -r 2 --template '{rstdoc("1st\n\n2nd", "htm\x6c")}' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
810 <p> |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
811 1st |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
812 </p> |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
813 <p> |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
814 2nd |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
815 </p> |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
816 $ hg log -R a -r 2 --template '{rstdoc(r"1st\n\n2nd", "html")}' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
817 <p> |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
818 1st\n\n2nd |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
819 </p> |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
820 $ hg log -R a -r 2 --template '{rstdoc("1st\n\n2nd", r"htm\x6c")}' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
821 1st |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
822 |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
823 2nd |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
824 |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
825 $ hg log -R a -r 2 --template '{strip(desc, "\x6e")}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
826 o perso |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
827 $ hg log -R a -r 2 --template '{strip(desc, r"\x6e")}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
828 no person |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
829 $ hg log -R a -r 2 --template '{strip("no perso\x6e", "\x6e")}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
830 o perso |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
831 $ hg log -R a -r 2 --template '{strip(r"no perso\x6e", r"\x6e")}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
832 no perso |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
833 |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
834 $ hg log -R a -r 2 --template '{sub("\\x6e", "\x2d", desc)}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
835 -o perso- |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
836 $ hg log -R a -r 2 --template '{sub(r"\\x6e", "-", desc)}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
837 no person |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
838 $ hg log -R a -r 2 --template '{sub("n", r"\x2d", desc)}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
839 \x2do perso\x2d |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
840 $ hg log -R a -r 2 --template '{sub("n", "\x2d", "no perso\x6e")}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
841 -o perso- |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
842 $ hg log -R a -r 2 --template '{sub("n", r"\x2d", r"no perso\x6e")}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
843 \x2do perso\x6e |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
844 |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
845 $ hg log -R a -r 8 --template '{files % "{file}\n"}' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
846 fourth |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
847 second |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
848 third |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
849 |
21024
7731a2281cf0
spelling: fixes from spell checker
Mads Kiilerich <madski@unity3d.com>
parents:
20860
diff
changeset
|
850 Test string escaping in nested expression: |
20663
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
851 |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
852 $ hg log -R a -r 8 --template '{ifeq(r"\x6e", if("1", "\x5c\x786e"), join(files, "\x5c\x786e"))}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
853 fourth\x6esecond\x6ethird |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
854 $ hg log -R a -r 8 --template '{ifeq(if("1", r"\x6e"), "\x5c\x786e", join(files, "\x5c\x786e"))}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
855 fourth\x6esecond\x6ethird |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
856 |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
857 $ hg log -R a -r 8 --template '{join(files, ifeq(branch, "default", "\x5c\x786e"))}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
858 fourth\x6esecond\x6ethird |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
859 $ hg log -R a -r 8 --template '{join(files, ifeq(branch, "default", r"\x5c\x786e"))}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
860 fourth\x5c\x786esecond\x5c\x786ethird |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
861 |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
862 $ hg log -R a -r 3:4 --template '{rev}:{sub(if("1", "\x6e"), ifeq(branch, "foo", r"\x5c\x786e", "\x5c\x786e"), desc)}\n' |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
863 3:\x6eo user, \x6eo domai\x6e |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
864 4:\x5c\x786eew bra\x5c\x786ech |
5ab28a2e9962
templater: make strings in template expressions be "string-escape"-ed correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20662
diff
changeset
|
865 |
25783
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25782
diff
changeset
|
866 Test quotes in nested expression are evaluated just like a $(command) |
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25782
diff
changeset
|
867 substitution in POSIX shells: |
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25782
diff
changeset
|
868 |
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25782
diff
changeset
|
869 $ hg log -R a -r 8 -T '{"{"{rev}:{node|short}"}"}\n' |
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25782
diff
changeset
|
870 8:95c24699272e |
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25782
diff
changeset
|
871 $ hg log -R a -r 8 -T '{"{"\{{rev}} \"{node|short}\""}"}\n' |
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25782
diff
changeset
|
872 {8} "95c24699272e" |
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25782
diff
changeset
|
873 |
20067
3d8bfe2ecf6d
templater: only recursively evaluate string literals as templates (issue4103)
Matt Mackall <mpm@selenic.com>
parents:
20066
diff
changeset
|
874 Test recursive evaluation: |
3d8bfe2ecf6d
templater: only recursively evaluate string literals as templates (issue4103)
Matt Mackall <mpm@selenic.com>
parents:
20066
diff
changeset
|
875 |
3d8bfe2ecf6d
templater: only recursively evaluate string literals as templates (issue4103)
Matt Mackall <mpm@selenic.com>
parents:
20066
diff
changeset
|
876 $ hg init r |
3d8bfe2ecf6d
templater: only recursively evaluate string literals as templates (issue4103)
Matt Mackall <mpm@selenic.com>
parents:
20066
diff
changeset
|
877 $ cd r |
3d8bfe2ecf6d
templater: only recursively evaluate string literals as templates (issue4103)
Matt Mackall <mpm@selenic.com>
parents:
20066
diff
changeset
|
878 $ echo a > a |
3d8bfe2ecf6d
templater: only recursively evaluate string literals as templates (issue4103)
Matt Mackall <mpm@selenic.com>
parents:
20066
diff
changeset
|
879 $ hg ci -Am '{rev}' |
3d8bfe2ecf6d
templater: only recursively evaluate string literals as templates (issue4103)
Matt Mackall <mpm@selenic.com>
parents:
20066
diff
changeset
|
880 adding a |
3d8bfe2ecf6d
templater: only recursively evaluate string literals as templates (issue4103)
Matt Mackall <mpm@selenic.com>
parents:
20066
diff
changeset
|
881 $ hg log -r 0 --template '{if(rev, desc)}\n' |
3d8bfe2ecf6d
templater: only recursively evaluate string literals as templates (issue4103)
Matt Mackall <mpm@selenic.com>
parents:
20066
diff
changeset
|
882 {rev} |
3d8bfe2ecf6d
templater: only recursively evaluate string literals as templates (issue4103)
Matt Mackall <mpm@selenic.com>
parents:
20066
diff
changeset
|
883 $ hg log -r 0 --template '{if(rev, "{author} {rev}")}\n' |
3d8bfe2ecf6d
templater: only recursively evaluate string literals as templates (issue4103)
Matt Mackall <mpm@selenic.com>
parents:
20066
diff
changeset
|
884 test 0 |
20076
faa4b3fc4197
templater: makes branches work correctly with stringify (issue4108)
Matt Mackall <mpm@selenic.com>
parents:
20067
diff
changeset
|
885 |
20661
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
886 $ hg branch -q 'text.{rev}' |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
887 $ echo aa >> aa |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
888 $ hg ci -u '{node|short}' -m 'desc to be wrapped desc to be wrapped' |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
889 |
20670 | 890 $ hg log -l1 --template '{fill(desc, "20", author, branch)}' |
20661
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
891 {node|short}desc to |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
892 text.{rev}be wrapped |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
893 text.{rev}desc to be |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
894 text.{rev}wrapped (no-eol) |
20670 | 895 $ hg log -l1 --template '{fill(desc, "20", "{node|short}:", "text.{rev}:")}' |
20661
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
896 bcc7ff960b8e:desc to |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
897 text.1:be wrapped |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
898 text.1:desc to be |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
899 text.1:wrapped (no-eol) |
28344
ac371d4c007f
templater: drop redundant type conversion when evaluating integer argument
Yuya Nishihara <yuya@tcha.org>
parents:
28333
diff
changeset
|
900 $ hg log -l1 -T '{fill(desc, date, "", "")}\n' |
ac371d4c007f
templater: drop redundant type conversion when evaluating integer argument
Yuya Nishihara <yuya@tcha.org>
parents:
28333
diff
changeset
|
901 hg: parse error: fill expects an integer width |
ac371d4c007f
templater: drop redundant type conversion when evaluating integer argument
Yuya Nishihara <yuya@tcha.org>
parents:
28333
diff
changeset
|
902 [255] |
20661
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
903 |
20670 | 904 $ hg log -l 1 --template '{sub(r"[0-9]", "-", author)}' |
20661
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
905 {node|short} (no-eol) |
20670 | 906 $ hg log -l 1 --template '{sub(r"[0-9]", "-", "{node|short}")}' |
20661
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
907 bcc-ff---b-e (no-eol) |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
908 |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
909 $ cat >> .hg/hgrc <<EOF |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
910 > [extensions] |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
911 > color= |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
912 > [color] |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
913 > mode=ansi |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
914 > text.{rev} = red |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
915 > text.1 = green |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
916 > EOF |
20670 | 917 $ hg log --color=always -l 1 --template '{label(branch, "text\n")}' |
20661
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
918 \x1b[0;31mtext\x1b[0m (esc) |
20670 | 919 $ hg log --color=always -l 1 --template '{label("text.{rev}", "text\n")}' |
20661
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
920 \x1b[0;32mtext\x1b[0m (esc) |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
921 |
20670 | 922 $ cd .. |
21822
028a48105191
templater: add symbol to error
Ryan McElroy <rmcelroy@fb.com>
parents:
21821
diff
changeset
|
923 |
028a48105191
templater: add symbol to error
Ryan McElroy <rmcelroy@fb.com>
parents:
21821
diff
changeset
|
924 Test bad template with better error message |
028a48105191
templater: add symbol to error
Ryan McElroy <rmcelroy@fb.com>
parents:
21821
diff
changeset
|
925 |
028a48105191
templater: add symbol to error
Ryan McElroy <rmcelroy@fb.com>
parents:
21821
diff
changeset
|
926 $ hg log -Gv -R a --template '{desc|user()}' |
028a48105191
templater: add symbol to error
Ryan McElroy <rmcelroy@fb.com>
parents:
21821
diff
changeset
|
927 hg: parse error: expected a symbol, got 'func' |
028a48105191
templater: add symbol to error
Ryan McElroy <rmcelroy@fb.com>
parents:
21821
diff
changeset
|
928 [255] |
21846
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
929 |
26215
72aad184f061
templater: create string unescape helper (issue4798)
Matt Mackall <mpm@selenic.com>
parents:
26188
diff
changeset
|
930 Test broken string escapes: |
72aad184f061
templater: create string unescape helper (issue4798)
Matt Mackall <mpm@selenic.com>
parents:
26188
diff
changeset
|
931 |
72aad184f061
templater: create string unescape helper (issue4798)
Matt Mackall <mpm@selenic.com>
parents:
26188
diff
changeset
|
932 $ hg log -T "bogus\\" -R a |
72aad184f061
templater: create string unescape helper (issue4798)
Matt Mackall <mpm@selenic.com>
parents:
26188
diff
changeset
|
933 hg: parse error: trailing \ in string |
72aad184f061
templater: create string unescape helper (issue4798)
Matt Mackall <mpm@selenic.com>
parents:
26188
diff
changeset
|
934 [255] |
72aad184f061
templater: create string unescape helper (issue4798)
Matt Mackall <mpm@selenic.com>
parents:
26188
diff
changeset
|
935 $ hg log -T "\\xy" -R a |
36635
e80f8a134731
test-command-template: glob out detailed "invalid escape" message
Yuya Nishihara <yuya@tcha.org>
parents:
36548
diff
changeset
|
936 hg: parse error: invalid \x escape* (glob) |
26215
72aad184f061
templater: create string unescape helper (issue4798)
Matt Mackall <mpm@selenic.com>
parents:
26188
diff
changeset
|
937 [255] |
26856
baa77652be68
templatefilters: try round-trip utf-8 conversion by json filter (issue4933)
Yuya Nishihara <yuya@tcha.org>
parents:
26504
diff
changeset
|
938 |
28912
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
939 Templater supports aliases of symbol and func() styles: |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
940 |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
941 $ hg clone -q a aliases |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
942 $ cd aliases |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
943 $ cat <<EOF >> .hg/hgrc |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
944 > [templatealias] |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
945 > r = rev |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
946 > rn = "{r}:{node|short}" |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
947 > status(c, files) = files % "{c} {file}\n" |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
948 > utcdate(d) = localdate(d, "UTC") |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
949 > EOF |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
950 |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
951 $ hg debugtemplate -vr0 '{rn} {utcdate(date)|isodate}\n' |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
952 (template |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
953 (symbol 'rn') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
954 (string ' ') |
28912
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
955 (| |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
956 (func |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
957 (symbol 'utcdate') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
958 (symbol 'date')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
959 (symbol 'isodate')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
960 (string '\n')) |
28912
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
961 * expanded: |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
962 (template |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
963 (template |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
964 (symbol 'rev') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
965 (string ':') |
28912
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
966 (| |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
967 (symbol 'node') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
968 (symbol 'short'))) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
969 (string ' ') |
28912
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
970 (| |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
971 (func |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
972 (symbol 'localdate') |
28912
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
973 (list |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
974 (symbol 'date') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
975 (string 'UTC'))) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
976 (symbol 'isodate')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
977 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
978 * keywords: date, node, rev |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
979 * functions: isodate, localdate, short |
28957
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
980 0:1e4e1b8f71e0 1970-01-12 13:46 +0000 |
28912
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
981 |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
982 $ hg debugtemplate -vr0 '{status("A", file_adds)}' |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
983 (template |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
984 (func |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
985 (symbol 'status') |
28912
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
986 (list |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
987 (string 'A') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
988 (symbol 'file_adds')))) |
28912
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
989 * expanded: |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
990 (template |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
991 (% |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
992 (symbol 'file_adds') |
28912
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
993 (template |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
994 (string 'A') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
995 (string ' ') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
996 (symbol 'file') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
997 (string '\n')))) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
998 * keywords: file, file_adds |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
999 * functions: |
28957
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1000 A a |
28912
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1001 |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1002 A unary function alias can be called as a filter: |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1003 |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1004 $ hg debugtemplate -vr0 '{date|utcdate|isodate}\n' |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1005 (template |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1006 (| |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1007 (| |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
1008 (symbol 'date') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
1009 (symbol 'utcdate')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
1010 (symbol 'isodate')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
1011 (string '\n')) |
28912
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1012 * expanded: |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1013 (template |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1014 (| |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1015 (func |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
1016 (symbol 'localdate') |
28912
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1017 (list |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
1018 (symbol 'date') |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
1019 (string 'UTC'))) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
1020 (symbol 'isodate')) |
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
1021 (string '\n')) |
38355
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
1022 * keywords: date |
d4fae9a0ab1f
templater: add function to look up symbols used in template
Yuya Nishihara <yuya@tcha.org>
parents:
38299
diff
changeset
|
1023 * functions: isodate, localdate |
28957
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1024 1970-01-12 13:46 +0000 |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1025 |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1026 Aliases should be applied only to command arguments and templates in hgrc. |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1027 Otherwise, our stock styles and web templates could be corrupted: |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1028 |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1029 $ hg log -r0 -T '{rn} {utcdate(date)|isodate}\n' |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1030 0:1e4e1b8f71e0 1970-01-12 13:46 +0000 |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1031 |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1032 $ hg log -r0 --config ui.logtemplate='"{rn} {utcdate(date)|isodate}\n"' |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1033 0:1e4e1b8f71e0 1970-01-12 13:46 +0000 |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1034 |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1035 $ cat <<EOF > tmpl |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1036 > changeset = 'nothing expanded:{rn}\n' |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1037 > EOF |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1038 $ hg log -r0 --style ./tmpl |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1039 nothing expanded: |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1040 |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1041 Aliases in formatter: |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1042 |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1043 $ hg branches -T '{pad(branch, 7)} {rn}\n' |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1044 default 6:d41e714fe50d |
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1045 foo 4:bbe44766e73d |
28912
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1046 |
28958
77e566fe31ec
ui: drop template aliases by HGPLAIN
Yuya Nishihara <yuya@tcha.org>
parents:
28957
diff
changeset
|
1047 Aliases should honor HGPLAIN: |
77e566fe31ec
ui: drop template aliases by HGPLAIN
Yuya Nishihara <yuya@tcha.org>
parents:
28957
diff
changeset
|
1048 |
77e566fe31ec
ui: drop template aliases by HGPLAIN
Yuya Nishihara <yuya@tcha.org>
parents:
28957
diff
changeset
|
1049 $ HGPLAIN= hg log -r0 -T 'nothing expanded:{rn}\n' |
77e566fe31ec
ui: drop template aliases by HGPLAIN
Yuya Nishihara <yuya@tcha.org>
parents:
28957
diff
changeset
|
1050 nothing expanded: |
77e566fe31ec
ui: drop template aliases by HGPLAIN
Yuya Nishihara <yuya@tcha.org>
parents:
28957
diff
changeset
|
1051 $ HGPLAINEXCEPT=templatealias hg log -r0 -T '{rn}\n' |
77e566fe31ec
ui: drop template aliases by HGPLAIN
Yuya Nishihara <yuya@tcha.org>
parents:
28957
diff
changeset
|
1052 0:1e4e1b8f71e0 |
77e566fe31ec
ui: drop template aliases by HGPLAIN
Yuya Nishihara <yuya@tcha.org>
parents:
28957
diff
changeset
|
1053 |
28912
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1054 Unparsable alias: |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1055 |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1056 $ hg debugtemplate --config templatealias.bad='x(' -v '{bad}' |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1057 (template |
34073
7bbc4e113e5f
parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org>
parents:
33950
diff
changeset
|
1058 (symbol 'bad')) |
29059
8eba4cdcfd81
parser: shorten prefix of alias parsing errors
Yuya Nishihara <yuya@tcha.org>
parents:
28958
diff
changeset
|
1059 abort: bad definition of template alias "bad": at 2: not a prefix: end |
28912
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1060 [255] |
28957
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1061 $ hg log --config templatealias.bad='x(' -T '{bad}' |
29059
8eba4cdcfd81
parser: shorten prefix of alias parsing errors
Yuya Nishihara <yuya@tcha.org>
parents:
28958
diff
changeset
|
1062 abort: bad definition of template alias "bad": at 2: not a prefix: end |
28957
d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Yuya Nishihara <yuya@tcha.org>
parents:
28912
diff
changeset
|
1063 [255] |
28912
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1064 |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1065 $ cd .. |
867d6ba2353d
templater: add parsing and expansion rules to process "templatealias" section
Yuya Nishihara <yuya@tcha.org>
parents:
28695
diff
changeset
|
1066 |
28695
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1067 Test that template function in extension is registered as expected |
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1068 |
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1069 $ cd a |
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1070 |
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1071 $ cat <<EOF > $TESTTMP/customfunc.py |
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1072 > from mercurial import registrar |
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1073 > |
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1074 > templatefunc = registrar.templatefunc() |
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1075 > |
36548
086fc71fbb09
py3: mark all string literals in test-command-template.t as bytes
Yuya Nishihara <yuya@tcha.org>
parents:
36542
diff
changeset
|
1076 > @templatefunc(b'custom()') |
28695
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1077 > def custom(context, mapping, args): |
36548
086fc71fbb09
py3: mark all string literals in test-command-template.t as bytes
Yuya Nishihara <yuya@tcha.org>
parents:
36542
diff
changeset
|
1078 > return b'custom' |
28695
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1079 > EOF |
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1080 $ cat <<EOF > .hg/hgrc |
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1081 > [extensions] |
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1082 > customfunc = $TESTTMP/customfunc.py |
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1083 > EOF |
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1084 |
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1085 $ hg log -r . -T "{custom()}\n" --config customfunc.enabled=true |
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1086 custom |
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1087 |
cc103bd0dbf9
registrar: add templatefunc to mark a function as template function (API)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28687
diff
changeset
|
1088 $ cd .. |