Mercurial > hg
annotate tests/test-template-functions.t @ 50970:f04568add4ee
debug_revlog_stats: migrate `opts` to native kwargs
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 21 Aug 2023 17:47:52 -0400 |
parents | c96ed4029fda |
children |
rev | line source |
---|---|
38434
70f551a3f52e
tests: extract test-template-functions.t from test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
38433
diff
changeset
|
1 Test template filters and functions |
70f551a3f52e
tests: extract test-template-functions.t from test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
38433
diff
changeset
|
2 =================================== |
70f551a3f52e
tests: extract test-template-functions.t from test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
38433
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 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
35 Second branch starting at nullrev: |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
36 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
37 $ hg update null |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
38 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
|
39 $ echo second > second |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
40 $ hg add second |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
41 $ 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
|
42 created new head |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
43 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
44 $ echo third > third |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
45 $ hg add third |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
46 $ hg mv second fourth |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
47 $ 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
|
48 |
22764
1e2f54a149e8
templater: set the correct phase for parents
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
22668
diff
changeset
|
49 $ hg phase -r 5 --public |
1e2f54a149e8
templater: set the correct phase for parents
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
22668
diff
changeset
|
50 $ hg phase -r 7 --secret --force |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
51 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
52 Filters work: |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
53 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
54 $ hg log --template '{author|domain}\n' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
55 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
56 hostname |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
57 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
58 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
59 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
60 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
61 place |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
62 place |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
63 hostname |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
64 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
65 $ hg log --template '{author|person}\n' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
66 test |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
67 User Name |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
68 person |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
69 person |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
70 person |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
71 person |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
72 other |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
73 A. N. Other |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
74 User Name |
9536
f04d17912441
cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents:
9382
diff
changeset
|
75 |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
76 $ hg log --template '{author|user}\n' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
77 test |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
78 user |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
79 person |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
80 person |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
81 person |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
82 person |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
83 other |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
84 other |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
85 user |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
86 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
87 $ hg log --template '{date|date}\n' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
88 Wed Jan 01 10:01:00 2020 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
89 Mon Jan 12 13:46:40 1970 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
90 Sun Jan 18 08:40:01 1970 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
91 Sun Jan 18 08:40:00 1970 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
92 Sat Jan 17 04:53:20 1970 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
93 Fri Jan 16 01:06:40 1970 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
94 Wed Jan 14 21:20:00 1970 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
95 Tue Jan 13 17:33:20 1970 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
96 Mon Jan 12 13:46:40 1970 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
97 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
98 $ hg log --template '{date|isodate}\n' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
99 2020-01-01 10:01 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
100 1970-01-12 13:46 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
101 1970-01-18 08:40 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
102 1970-01-18 08:40 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
103 1970-01-17 04:53 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
104 1970-01-16 01:06 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
105 1970-01-14 21:20 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
106 1970-01-13 17:33 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
107 1970-01-12 13:46 +0000 |
9536
f04d17912441
cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents:
9382
diff
changeset
|
108 |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
109 $ hg log --template '{date|isodatesec}\n' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
110 2020-01-01 10:01:00 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
111 1970-01-12 13:46:40 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
112 1970-01-18 08:40:01 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
113 1970-01-18 08:40:00 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
114 1970-01-17 04:53:20 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
115 1970-01-16 01:06:40 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
116 1970-01-14 21:20:00 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
117 1970-01-13 17:33:20 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
118 1970-01-12 13:46:40 +0000 |
9536
f04d17912441
cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents:
9382
diff
changeset
|
119 |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
120 $ hg log --template '{date|rfc822date}\n' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
121 Wed, 01 Jan 2020 10:01:00 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
122 Mon, 12 Jan 1970 13:46:40 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
123 Sun, 18 Jan 1970 08:40:01 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
124 Sun, 18 Jan 1970 08:40:00 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
125 Sat, 17 Jan 1970 04:53:20 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
126 Fri, 16 Jan 1970 01:06:40 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
127 Wed, 14 Jan 1970 21:20:00 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
128 Tue, 13 Jan 1970 17:33:20 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
129 Mon, 12 Jan 1970 13:46:40 +0000 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
130 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
131 $ hg log --template '{desc|firstline}\n' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
132 third |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
133 second |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
134 merge |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
135 new head |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
136 new branch |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
137 no user, no domain |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
138 no person |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
139 other 1 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
140 line 1 |
9536
f04d17912441
cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents:
9382
diff
changeset
|
141 |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
142 $ hg log --template '{node|short}\n' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
143 95c24699272e |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
144 29114dbae42b |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13666
diff
changeset
|
145 d41e714fe50d |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
146 13207e5a10d9 |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13666
diff
changeset
|
147 bbe44766e73d |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
148 10e46f2dcbf4 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
149 97054abb4ab8 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
150 b608e9d1a3f0 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
151 1e4e1b8f71e0 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
152 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
153 $ hg log --template '<changeset author="{author|xmlescape}"/>\n' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
154 <changeset author="test"/> |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
155 <changeset author="User Name <user@hostname>"/> |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
156 <changeset author="person"/> |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
157 <changeset author="person"/> |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
158 <changeset author="person"/> |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
159 <changeset author="person"/> |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
160 <changeset author="other@place"/> |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
161 <changeset author="A. N. Other <other@place>"/> |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
162 <changeset author="User Name <user@hostname>"/> |
9536
f04d17912441
cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents:
9382
diff
changeset
|
163 |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
164 $ hg log --template '{rev}: {children}\n' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
165 8: |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
166 7: 8:95c24699272e |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
167 6: |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13666
diff
changeset
|
168 5: 6:d41e714fe50d |
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13666
diff
changeset
|
169 4: 6:d41e714fe50d |
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13666
diff
changeset
|
170 3: 4:bbe44766e73d 5:13207e5a10d9 |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
171 2: 3:10e46f2dcbf4 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
172 1: 2:97054abb4ab8 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
173 0: 1:b608e9d1a3f0 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
174 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
175 Formatnode filter works: |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
176 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
177 $ hg -q log -r 0 --template '{node|formatnode}\n' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
178 1e4e1b8f71e0 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
179 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
180 $ hg log -r 0 --template '{node|formatnode}\n' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
181 1e4e1b8f71e0 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
182 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
183 $ hg -v log -r 0 --template '{node|formatnode}\n' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
184 1e4e1b8f71e0 |
9536
f04d17912441
cmdutil: templating keywords latesttag and latesttagdistance
Mads Kiilerich <mads@kiilerich.com>
parents:
9382
diff
changeset
|
185 |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
186 $ hg --debug log -r 0 --template '{node|formatnode}\n' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
187 1e4e1b8f71e05681d422154f5421e385fec3454f |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
188 |
15839
43317af36d28
tests: make {date|age} template output independent of the current date
Steven Brown <StevenGBrown@gmail.com>
parents:
15773
diff
changeset
|
189 Age filter: |
43317af36d28
tests: make {date|age} template output independent of the current date
Steven Brown <StevenGBrown@gmail.com>
parents:
15773
diff
changeset
|
190 |
25005
5ddbb024c2e9
tests: fix hidden repeatability problem with age filter test
Matt Mackall <mpm@selenic.com>
parents:
25003
diff
changeset
|
191 $ hg init unstable-hash |
5ddbb024c2e9
tests: fix hidden repeatability problem with age filter test
Matt Mackall <mpm@selenic.com>
parents:
25003
diff
changeset
|
192 $ cd unstable-hash |
15839
43317af36d28
tests: make {date|age} template output independent of the current date
Steven Brown <StevenGBrown@gmail.com>
parents:
15773
diff
changeset
|
193 $ hg log --template '{date|age}\n' > /dev/null || exit 1 |
43317af36d28
tests: make {date|age} template output independent of the current date
Steven Brown <StevenGBrown@gmail.com>
parents:
15773
diff
changeset
|
194 |
33950
42361715dd11
tests: update test-command-template to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
33865
diff
changeset
|
195 >>> import datetime |
36504
b075f45456a5
py3: fix test-command-template.t to write files in binary mode
Yuya Nishihara <yuya@tcha.org>
parents:
36445
diff
changeset
|
196 >>> fp = open('a', 'wb') |
33950
42361715dd11
tests: update test-command-template to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
33865
diff
changeset
|
197 >>> n = datetime.datetime.now() + datetime.timedelta(366 * 7) |
36542
106e93d16435
py3: silence return value of file.write() in test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
36504
diff
changeset
|
198 >>> fp.write(b'%d-%d-%d 00:00' % (n.year, n.month, n.day)) and None |
15839
43317af36d28
tests: make {date|age} template output independent of the current date
Steven Brown <StevenGBrown@gmail.com>
parents:
15773
diff
changeset
|
199 >>> fp.close() |
43317af36d28
tests: make {date|age} template output independent of the current date
Steven Brown <StevenGBrown@gmail.com>
parents:
15773
diff
changeset
|
200 $ hg add a |
43317af36d28
tests: make {date|age} template output independent of the current date
Steven Brown <StevenGBrown@gmail.com>
parents:
15773
diff
changeset
|
201 $ hg commit -m future -d "`cat a`" |
43317af36d28
tests: make {date|age} template output independent of the current date
Steven Brown <StevenGBrown@gmail.com>
parents:
15773
diff
changeset
|
202 |
17345
4f8054d3171b
check-code: fix check for trailing whitespace on sh command lines
Mads Kiilerich <mads@kiilerich.com>
parents:
17334
diff
changeset
|
203 $ hg log -l1 --template '{date|age}\n' |
15839
43317af36d28
tests: make {date|age} template output independent of the current date
Steven Brown <StevenGBrown@gmail.com>
parents:
15773
diff
changeset
|
204 7 years from now |
43317af36d28
tests: make {date|age} template output independent of the current date
Steven Brown <StevenGBrown@gmail.com>
parents:
15773
diff
changeset
|
205 |
25005
5ddbb024c2e9
tests: fix hidden repeatability problem with age filter test
Matt Mackall <mpm@selenic.com>
parents:
25003
diff
changeset
|
206 $ cd .. |
5ddbb024c2e9
tests: fix hidden repeatability problem with age filter test
Matt Mackall <mpm@selenic.com>
parents:
25003
diff
changeset
|
207 $ rm -rf unstable-hash |
5ddbb024c2e9
tests: fix hidden repeatability problem with age filter test
Matt Mackall <mpm@selenic.com>
parents:
25003
diff
changeset
|
208 |
35539
d1aae6d4efc5
templatefilters: fix doc of basename()
Yuya Nishihara <yuya@tcha.org>
parents:
34866
diff
changeset
|
209 Filename filters: |
d1aae6d4efc5
templatefilters: fix doc of basename()
Yuya Nishihara <yuya@tcha.org>
parents:
34866
diff
changeset
|
210 |
d1aae6d4efc5
templatefilters: fix doc of basename()
Yuya Nishihara <yuya@tcha.org>
parents:
34866
diff
changeset
|
211 $ hg debugtemplate '{"foo/bar"|basename}|{"foo/"|basename}|{"foo"|basename}|\n' |
d1aae6d4efc5
templatefilters: fix doc of basename()
Yuya Nishihara <yuya@tcha.org>
parents:
34866
diff
changeset
|
212 bar||foo| |
36246
9ee10b3284da
templatefilters: add dirname() filter
Yuya Nishihara <yuya@tcha.org>
parents:
35751
diff
changeset
|
213 $ hg debugtemplate '{"foo/bar"|dirname}|{"foo/"|dirname}|{"foo"|dirname}|\n' |
9ee10b3284da
templatefilters: add dirname() filter
Yuya Nishihara <yuya@tcha.org>
parents:
35751
diff
changeset
|
214 foo|foo|| |
9ee10b3284da
templatefilters: add dirname() filter
Yuya Nishihara <yuya@tcha.org>
parents:
35751
diff
changeset
|
215 $ hg debugtemplate '{"foo/bar"|stripdir}|{"foo/"|stripdir}|{"foo"|stripdir}|\n' |
9ee10b3284da
templatefilters: add dirname() filter
Yuya Nishihara <yuya@tcha.org>
parents:
35751
diff
changeset
|
216 foo|foo|foo| |
35539
d1aae6d4efc5
templatefilters: fix doc of basename()
Yuya Nishihara <yuya@tcha.org>
parents:
34866
diff
changeset
|
217 |
38435
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
218 commondir() filter: |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
219 |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
220 $ hg debugtemplate '{""|splitlines|commondir}\n' |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
221 |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
222 $ hg debugtemplate '{"foo/bar\nfoo/baz\nfoo/foobar\n"|splitlines|commondir}\n' |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
223 foo |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
224 $ hg debugtemplate '{"foo/bar\nfoo/bar\n"|splitlines|commondir}\n' |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
225 foo |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
226 $ hg debugtemplate '{"/foo/bar\n/foo/bar\n"|splitlines|commondir}\n' |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
227 foo |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
228 $ hg debugtemplate '{"/foo\n/foo\n"|splitlines|commondir}\n' |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
229 |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
230 $ hg debugtemplate '{"foo/bar\nbar/baz"|splitlines|commondir}\n' |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
231 |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
232 $ hg debugtemplate '{"foo/bar\nbar/baz\nbar/foo\n"|splitlines|commondir}\n' |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
233 |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
234 $ hg debugtemplate '{"foo/../bar\nfoo/bar"|splitlines|commondir}\n' |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
235 foo |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
236 $ hg debugtemplate '{"foo\n/foo"|splitlines|commondir}\n' |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
237 |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
238 |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
239 $ hg log -r null -T '{rev|commondir}' |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
240 hg: parse error: argument is not a list of text |
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
241 (template filter 'commondir' is not compatible with keyword 'rev') |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
242 [10] |
38435
6a8ed5c7e112
tests: fold test-template-filters.t into test-template-functions.t
Yuya Nishihara <yuya@tcha.org>
parents:
38434
diff
changeset
|
243 |
25005
5ddbb024c2e9
tests: fix hidden repeatability problem with age filter test
Matt Mackall <mpm@selenic.com>
parents:
25003
diff
changeset
|
244 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
|
245 |
5ddbb024c2e9
tests: fix hidden repeatability problem with age filter test
Matt Mackall <mpm@selenic.com>
parents:
25003
diff
changeset
|
246 $ echo a > a |
5ddbb024c2e9
tests: fix hidden repeatability problem with age filter test
Matt Mackall <mpm@selenic.com>
parents:
25003
diff
changeset
|
247 $ hg add a |
5ddbb024c2e9
tests: fix hidden repeatability problem with age filter test
Matt Mackall <mpm@selenic.com>
parents:
25003
diff
changeset
|
248 $ hg ci -m future |
5ddbb024c2e9
tests: fix hidden repeatability problem with age filter test
Matt Mackall <mpm@selenic.com>
parents:
25003
diff
changeset
|
249 |
22668
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
250 Count filter: |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
251 |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
252 $ hg log -l1 --template '{node|count} {node|short|count}\n' |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
253 40 12 |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
254 |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
255 $ hg log -l1 --template '{revset("null^")|count} {revset(".")|count} {revset("0::3")|count}\n' |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
256 0 1 4 |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
257 |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
258 $ hg log -G --template '{rev}: children: {children|count}, \ |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
259 > tags: {tags|count}, file_adds: {file_adds|count}, \ |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
260 > ancestors: {revset("ancestors(%s)", rev)|count}' |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
261 @ 9: children: 0, tags: 1, file_adds: 1, ancestors: 3 |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
262 | |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
263 o 8: children: 1, tags: 0, file_adds: 2, ancestors: 2 |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
264 | |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
265 o 7: children: 1, tags: 0, file_adds: 1, ancestors: 1 |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
266 |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
267 o 6: children: 0, tags: 0, file_adds: 0, ancestors: 7 |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
268 |\ |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
269 | o 5: children: 1, tags: 0, file_adds: 1, ancestors: 5 |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
270 | | |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
271 o | 4: children: 1, tags: 0, file_adds: 0, ancestors: 5 |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
272 |/ |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
273 o 3: children: 2, tags: 0, file_adds: 0, ancestors: 4 |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
274 | |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
275 o 2: children: 1, tags: 0, file_adds: 1, ancestors: 3 |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
276 | |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
277 o 1: children: 1, tags: 0, file_adds: 1, ancestors: 2 |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
278 | |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
279 o 0: children: 1, tags: 0, file_adds: 1, ancestors: 1 |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
280 |
13e3f07d74a3
templater: add count template filter, plus tests
Anton Shestakov <engored@ya.ru>
parents:
22588
diff
changeset
|
281 |
37229
05db42732fce
templatefilters: handle TypeError by count()
Yuya Nishihara <yuya@tcha.org>
parents:
37227
diff
changeset
|
282 $ hg log -l1 -T '{termwidth|count}\n' |
05db42732fce
templatefilters: handle TypeError by count()
Yuya Nishihara <yuya@tcha.org>
parents:
37227
diff
changeset
|
283 hg: parse error: not countable |
05db42732fce
templatefilters: handle TypeError by count()
Yuya Nishihara <yuya@tcha.org>
parents:
37227
diff
changeset
|
284 (template filter 'count' is not compatible with keyword 'termwidth') |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
285 [10] |
37229
05db42732fce
templatefilters: handle TypeError by count()
Yuya Nishihara <yuya@tcha.org>
parents:
37227
diff
changeset
|
286 |
24566
6abce80e6cbf
templatefilters: add "upper" and "lower" for case conversion
Yuya Nishihara <yuya@tcha.org>
parents:
24319
diff
changeset
|
287 Upper/lower filters: |
6abce80e6cbf
templatefilters: add "upper" and "lower" for case conversion
Yuya Nishihara <yuya@tcha.org>
parents:
24319
diff
changeset
|
288 |
6abce80e6cbf
templatefilters: add "upper" and "lower" for case conversion
Yuya Nishihara <yuya@tcha.org>
parents:
24319
diff
changeset
|
289 $ hg log -r0 --template '{branch|upper}\n' |
6abce80e6cbf
templatefilters: add "upper" and "lower" for case conversion
Yuya Nishihara <yuya@tcha.org>
parents:
24319
diff
changeset
|
290 DEFAULT |
6abce80e6cbf
templatefilters: add "upper" and "lower" for case conversion
Yuya Nishihara <yuya@tcha.org>
parents:
24319
diff
changeset
|
291 $ hg log -r0 --template '{author|lower}\n' |
6abce80e6cbf
templatefilters: add "upper" and "lower" for case conversion
Yuya Nishihara <yuya@tcha.org>
parents:
24319
diff
changeset
|
292 user name <user@hostname> |
6abce80e6cbf
templatefilters: add "upper" and "lower" for case conversion
Yuya Nishihara <yuya@tcha.org>
parents:
24319
diff
changeset
|
293 $ hg log -r0 --template '{date|upper}\n' |
38299
88e7105b5cd9
templater: restore the original string format of {date}
Yuya Nishihara <yuya@tcha.org>
parents:
38289
diff
changeset
|
294 1000000.00 |
24566
6abce80e6cbf
templatefilters: add "upper" and "lower" for case conversion
Yuya Nishihara <yuya@tcha.org>
parents:
24319
diff
changeset
|
295 |
24985
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
296 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
|
297 |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
298 $ echo modify >> third |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
299 $ touch b |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
300 $ hg add b |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
301 $ 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
|
302 $ hg rm a |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
303 $ 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
|
304 |
24280
6c55e37ba5f2
templater: allow piping generator-type function output to filters
Yuya Nishihara <yuya@tcha.org>
parents:
24241
diff
changeset
|
305 Pass generator object created by template function to filter |
6c55e37ba5f2
templater: allow piping generator-type function output to filters
Yuya Nishihara <yuya@tcha.org>
parents:
24241
diff
changeset
|
306 |
6c55e37ba5f2
templater: allow piping generator-type function output to filters
Yuya Nishihara <yuya@tcha.org>
parents:
24241
diff
changeset
|
307 $ hg log -l 1 --template '{if(author, author)|user}\n' |
6c55e37ba5f2
templater: allow piping generator-type function output to filters
Yuya Nishihara <yuya@tcha.org>
parents:
24241
diff
changeset
|
308 test |
6c55e37ba5f2
templater: allow piping generator-type function output to filters
Yuya Nishihara <yuya@tcha.org>
parents:
24241
diff
changeset
|
309 |
22434
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
310 Test diff function: |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
311 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
312 $ hg diff -c 8 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
313 diff -r 29114dbae42b -r 95c24699272e fourth |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
314 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
315 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
316 @@ -0,0 +1,1 @@ |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
317 +second |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
318 diff -r 29114dbae42b -r 95c24699272e second |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
319 --- a/second Mon Jan 12 13:46:40 1970 +0000 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
320 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
321 @@ -1,1 +0,0 @@ |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
322 -second |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
323 diff -r 29114dbae42b -r 95c24699272e third |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
324 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
325 +++ b/third Wed Jan 01 10:01:00 2020 +0000 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
326 @@ -0,0 +1,1 @@ |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
327 +third |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
328 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
329 $ hg log -r 8 -T "{diff()}" |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
330 diff -r 29114dbae42b -r 95c24699272e fourth |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
331 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
332 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
333 @@ -0,0 +1,1 @@ |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
334 +second |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
335 diff -r 29114dbae42b -r 95c24699272e second |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
336 --- a/second Mon Jan 12 13:46:40 1970 +0000 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
337 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
338 @@ -1,1 +0,0 @@ |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
339 -second |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
340 diff -r 29114dbae42b -r 95c24699272e third |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
341 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
342 +++ b/third Wed Jan 01 10:01:00 2020 +0000 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
343 @@ -0,0 +1,1 @@ |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
344 +third |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
345 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
346 $ hg log -r 8 -T "{diff('glob:f*')}" |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
347 diff -r 29114dbae42b -r 95c24699272e fourth |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
348 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
349 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
350 @@ -0,0 +1,1 @@ |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
351 +second |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
352 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
353 $ hg log -r 8 -T "{diff('', 'glob:f*')}" |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
354 diff -r 29114dbae42b -r 95c24699272e second |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
355 --- a/second Mon Jan 12 13:46:40 1970 +0000 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
356 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
357 @@ -1,1 +0,0 @@ |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
358 -second |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
359 diff -r 29114dbae42b -r 95c24699272e third |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
360 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
361 +++ b/third Wed Jan 01 10:01:00 2020 +0000 |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
362 @@ -0,0 +1,1 @@ |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
363 +third |
40ce05b50148
templater: add "diff" template function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22427
diff
changeset
|
364 |
25562
9452112c8eb0
templater: evaluate arguments passed to diff() appropriately
Yuya Nishihara <yuya@tcha.org>
parents:
25471
diff
changeset
|
365 $ hg log -r 8 -T "{diff('FOURTH'|lower)}" |
9452112c8eb0
templater: evaluate arguments passed to diff() appropriately
Yuya Nishihara <yuya@tcha.org>
parents:
25471
diff
changeset
|
366 diff -r 29114dbae42b -r 95c24699272e fourth |
9452112c8eb0
templater: evaluate arguments passed to diff() appropriately
Yuya Nishihara <yuya@tcha.org>
parents:
25471
diff
changeset
|
367 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
9452112c8eb0
templater: evaluate arguments passed to diff() appropriately
Yuya Nishihara <yuya@tcha.org>
parents:
25471
diff
changeset
|
368 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000 |
9452112c8eb0
templater: evaluate arguments passed to diff() appropriately
Yuya Nishihara <yuya@tcha.org>
parents:
25471
diff
changeset
|
369 @@ -0,0 +1,1 @@ |
9452112c8eb0
templater: evaluate arguments passed to diff() appropriately
Yuya Nishihara <yuya@tcha.org>
parents:
25471
diff
changeset
|
370 +second |
9452112c8eb0
templater: evaluate arguments passed to diff() appropriately
Yuya Nishihara <yuya@tcha.org>
parents:
25471
diff
changeset
|
371 |
43051
da3329fe01e3
templatefuncs: account for user's diffopts in diff() (BC)
Denis Laxalde <denis@laxalde.org>
parents:
42893
diff
changeset
|
372 $ hg --config diff.git=true log -r 8 -T "{diff()}" |
da3329fe01e3
templatefuncs: account for user's diffopts in diff() (BC)
Denis Laxalde <denis@laxalde.org>
parents:
42893
diff
changeset
|
373 diff --git a/second b/fourth |
da3329fe01e3
templatefuncs: account for user's diffopts in diff() (BC)
Denis Laxalde <denis@laxalde.org>
parents:
42893
diff
changeset
|
374 rename from second |
da3329fe01e3
templatefuncs: account for user's diffopts in diff() (BC)
Denis Laxalde <denis@laxalde.org>
parents:
42893
diff
changeset
|
375 rename to fourth |
da3329fe01e3
templatefuncs: account for user's diffopts in diff() (BC)
Denis Laxalde <denis@laxalde.org>
parents:
42893
diff
changeset
|
376 diff --git a/third b/third |
da3329fe01e3
templatefuncs: account for user's diffopts in diff() (BC)
Denis Laxalde <denis@laxalde.org>
parents:
42893
diff
changeset
|
377 new file mode 100644 |
da3329fe01e3
templatefuncs: account for user's diffopts in diff() (BC)
Denis Laxalde <denis@laxalde.org>
parents:
42893
diff
changeset
|
378 --- /dev/null |
da3329fe01e3
templatefuncs: account for user's diffopts in diff() (BC)
Denis Laxalde <denis@laxalde.org>
parents:
42893
diff
changeset
|
379 +++ b/third |
da3329fe01e3
templatefuncs: account for user's diffopts in diff() (BC)
Denis Laxalde <denis@laxalde.org>
parents:
42893
diff
changeset
|
380 @@ -0,0 +1,1 @@ |
da3329fe01e3
templatefuncs: account for user's diffopts in diff() (BC)
Denis Laxalde <denis@laxalde.org>
parents:
42893
diff
changeset
|
381 +third |
da3329fe01e3
templatefuncs: account for user's diffopts in diff() (BC)
Denis Laxalde <denis@laxalde.org>
parents:
42893
diff
changeset
|
382 |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
383 $ cd .. |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
384 |
38434
70f551a3f52e
tests: extract test-template-functions.t from test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
38433
diff
changeset
|
385 latesttag() function: |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
386 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
387 $ hg init latesttag |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
388 $ cd latesttag |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
389 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
390 $ echo a > file |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
391 $ hg ci -Am a -d '0 0' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
392 adding file |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
393 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
394 $ echo b >> file |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
395 $ hg ci -m b -d '1 0' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
396 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
397 $ echo c >> head1 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
398 $ hg ci -Am h1c -d '2 0' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
399 adding head1 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
400 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
401 $ hg update -q 1 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
402 $ echo d >> head2 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
403 $ hg ci -Am h2d -d '3 0' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
404 adding head2 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
405 created new head |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
406 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
407 $ echo e >> head2 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
408 $ hg ci -m h2e -d '4 0' |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
409 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
410 $ hg merge -q |
19989
c38c3fdc8b93
date: allow %z in format (issue4040)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
411 $ hg ci -m merge -d '5 -3600' |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
412 |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
413 $ 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
|
414 $ 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
|
415 $ 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
|
416 $ 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
|
417 $ 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
|
418 $ 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
|
419 |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
420 $ hg log -G --template "{rev}: {latesttag('re:^t[13]$') % '{tag}, C: {changes}, D: {distance}'}\n" |
33862
fb672eac2702
templatekw: choose {latesttag} by len(changes), not date (issue5659)
Martin von Zweigbergk <martinvonz@google.com>
parents:
33861
diff
changeset
|
421 @ 11: t3, C: 9, D: 8 |
fb672eac2702
templatekw: choose {latesttag} by len(changes), not date (issue5659)
Martin von Zweigbergk <martinvonz@google.com>
parents:
33861
diff
changeset
|
422 | |
fb672eac2702
templatekw: choose {latesttag} by len(changes), not date (issue5659)
Martin von Zweigbergk <martinvonz@google.com>
parents:
33861
diff
changeset
|
423 o 10: t3, C: 8, D: 7 |
33861
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
424 | |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
425 o 9: t3, C: 7, D: 6 |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
426 | |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
427 o 8: t3, C: 6, D: 5 |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
428 | |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
429 o 7: t3, C: 5, D: 4 |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
430 | |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
431 o 6: t3, C: 4, D: 3 |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
432 | |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
433 o 5: t3, C: 3, D: 2 |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
434 |\ |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
435 | o 4: t3, C: 1, D: 1 |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
436 | | |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
437 | o 3: t3, C: 0, D: 0 |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
438 | | |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
439 o | 2: t1, C: 1, D: 1 |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
440 |/ |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
441 o 1: t1, C: 0, D: 0 |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
442 | |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
443 o 0: null, C: 1, D: 1 |
0e15d5ae52cf
tests: use graph log in {latesttag} tests
Martin von Zweigbergk <martinvonz@google.com>
parents:
33542
diff
changeset
|
444 |
26485
43bf9471fae9
templater: introduce {latesttag()} function to match a pattern (issue4184)
Matt Harbison <matt_harbison@yahoo.com>
parents:
26234
diff
changeset
|
445 |
12283
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
446 $ cd .. |
850e089eb41c
tests: unify test-command-template
Adrian Buehlmann <adrian@cadifra.com>
parents:
11656
diff
changeset
|
447 |
38448
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
448 Test filter() empty values: |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
449 |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
450 $ hg log -R a -r 1 -T '{filter(desc|splitlines) % "{line}\n"}' |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
451 other 1 |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
452 other 2 |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
453 other 3 |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
454 $ hg log -R a -r 0 -T '{filter(dict(a=0, b=1) % "{ifeq(key, "a", "{value}\n")}")}' |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
455 0 |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
456 |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
457 0 should not be falsy |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
458 |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
459 $ hg log -R a -r 0 -T '{filter(revset("0:2"))}\n' |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
460 0 1 2 |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
461 |
38449
bc8d925342f0
templater: extend filter() to accept template expression for emptiness test
Yuya Nishihara <yuya@tcha.org>
parents:
38448
diff
changeset
|
462 Test filter() by expression: |
bc8d925342f0
templater: extend filter() to accept template expression for emptiness test
Yuya Nishihara <yuya@tcha.org>
parents:
38448
diff
changeset
|
463 |
bc8d925342f0
templater: extend filter() to accept template expression for emptiness test
Yuya Nishihara <yuya@tcha.org>
parents:
38448
diff
changeset
|
464 $ hg log -R a -r 1 -T '{filter(desc|splitlines, ifcontains("1", line, "t"))}\n' |
bc8d925342f0
templater: extend filter() to accept template expression for emptiness test
Yuya Nishihara <yuya@tcha.org>
parents:
38448
diff
changeset
|
465 other 1 |
bc8d925342f0
templater: extend filter() to accept template expression for emptiness test
Yuya Nishihara <yuya@tcha.org>
parents:
38448
diff
changeset
|
466 $ hg log -R a -r 0 -T '{filter(dict(a=0, b=1), ifeq(key, "b", "t"))}\n' |
bc8d925342f0
templater: extend filter() to accept template expression for emptiness test
Yuya Nishihara <yuya@tcha.org>
parents:
38448
diff
changeset
|
467 b=1 |
bc8d925342f0
templater: extend filter() to accept template expression for emptiness test
Yuya Nishihara <yuya@tcha.org>
parents:
38448
diff
changeset
|
468 |
38448
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
469 Test filter() shouldn't crash: |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
470 |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
471 $ hg log -R a -r 0 -T '{filter(extras)}\n' |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
472 branch=default |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
473 $ hg log -R a -r 0 -T '{filter(files)}\n' |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
474 a |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
475 |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
476 Test filter() unsupported arguments: |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
477 |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
478 $ hg log -R a -r 0 -T '{filter()}\n' |
38449
bc8d925342f0
templater: extend filter() to accept template expression for emptiness test
Yuya Nishihara <yuya@tcha.org>
parents:
38448
diff
changeset
|
479 hg: parse error: filter expects one or two arguments |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
480 [10] |
38448
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
481 $ hg log -R a -r 0 -T '{filter(date)}\n' |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
482 hg: parse error: date is not iterable |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
483 [10] |
38448
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
484 $ hg log -R a -r 0 -T '{filter(rev)}\n' |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
485 hg: parse error: 0 is not iterable |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
486 [10] |
38448
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
487 $ hg log -R a -r 0 -T '{filter(desc|firstline)}\n' |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
488 hg: parse error: 'line 1' is not filterable |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
489 [10] |
38448
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
490 $ hg log -R a -r 0 -T '{filter(manifest)}\n' |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
491 hg: parse error: '0:a0c8bcbbb45c' is not filterable |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
492 [10] |
38448
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
493 $ hg log -R a -r 0 -T '{filter(succsandmarkers)}\n' |
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
494 hg: parse error: not filterable without template |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
495 [10] |
38449
bc8d925342f0
templater: extend filter() to accept template expression for emptiness test
Yuya Nishihara <yuya@tcha.org>
parents:
38448
diff
changeset
|
496 $ hg log -R a -r 0 -T '{filter(desc|splitlines % "{line}", "")}\n' |
bc8d925342f0
templater: extend filter() to accept template expression for emptiness test
Yuya Nishihara <yuya@tcha.org>
parents:
38448
diff
changeset
|
497 hg: parse error: not filterable by expression |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
498 [10] |
38448
dae829b4de78
templater: introduce filter() function to remove empty items from list
Yuya Nishihara <yuya@tcha.org>
parents:
38447
diff
changeset
|
499 |
38228
8bded7eae26c
templater: consistently join() string-like object per character (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
38227
diff
changeset
|
500 Test manifest/get() can be join()-ed as string, though it's silly: |
8bded7eae26c
templater: consistently join() string-like object per character (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
38227
diff
changeset
|
501 |
8bded7eae26c
templater: consistently join() string-like object per character (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
38227
diff
changeset
|
502 $ hg log -R latesttag -r tip -T '{join(manifest, ".")}\n' |
8bded7eae26c
templater: consistently join() string-like object per character (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
38227
diff
changeset
|
503 1.1.:.2.b.c.6.e.9.0.0.6.c.e.2 |
8bded7eae26c
templater: consistently join() string-like object per character (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
38227
diff
changeset
|
504 $ hg log -R latesttag -r tip -T '{join(get(extras, "branch"), ".")}\n' |
8bded7eae26c
templater: consistently join() string-like object per character (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
38227
diff
changeset
|
505 d.e.f.a.u.l.t |
34330
89aec1834a86
templatekw: add new-style template expansion to {manifest}
Yuya Nishihara <yuya@tcha.org>
parents:
34329
diff
changeset
|
506 |
38227
1c8098cf560a
templater: always join() over a wrapped object (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
37947
diff
changeset
|
507 Test join() over string |
1c8098cf560a
templater: always join() over a wrapped object (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
37947
diff
changeset
|
508 |
1c8098cf560a
templater: always join() over a wrapped object (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
37947
diff
changeset
|
509 $ hg log -R latesttag -r tip -T '{join(rev|stringify, ".")}\n' |
1c8098cf560a
templater: always join() over a wrapped object (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
37947
diff
changeset
|
510 1.1 |
1c8098cf560a
templater: always join() over a wrapped object (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
37947
diff
changeset
|
511 |
1c8098cf560a
templater: always join() over a wrapped object (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
37947
diff
changeset
|
512 Test join() over uniterable |
1c8098cf560a
templater: always join() over a wrapped object (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
37947
diff
changeset
|
513 |
1c8098cf560a
templater: always join() over a wrapped object (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
37947
diff
changeset
|
514 $ hg log -R latesttag -r tip -T '{join(rev, "")}\n' |
1c8098cf560a
templater: always join() over a wrapped object (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
37947
diff
changeset
|
515 hg: parse error: 11 is not iterable |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
516 [10] |
38227
1c8098cf560a
templater: always join() over a wrapped object (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
37947
diff
changeset
|
517 |
34581
ee0d74083a22
templater: store revisions as ints so min/max won't compare them as strings
Yuya Nishihara <yuya@tcha.org>
parents:
34541
diff
changeset
|
518 Test min/max of integers |
ee0d74083a22
templater: store revisions as ints so min/max won't compare them as strings
Yuya Nishihara <yuya@tcha.org>
parents:
34541
diff
changeset
|
519 |
ee0d74083a22
templater: store revisions as ints so min/max won't compare them as strings
Yuya Nishihara <yuya@tcha.org>
parents:
34541
diff
changeset
|
520 $ hg log -R latesttag -l1 -T '{min(revset("9:10"))}\n' |
ee0d74083a22
templater: store revisions as ints so min/max won't compare them as strings
Yuya Nishihara <yuya@tcha.org>
parents:
34541
diff
changeset
|
521 9 |
ee0d74083a22
templater: store revisions as ints so min/max won't compare them as strings
Yuya Nishihara <yuya@tcha.org>
parents:
34541
diff
changeset
|
522 $ hg log -R latesttag -l1 -T '{max(revset("9:10"))}\n' |
ee0d74083a22
templater: store revisions as ints so min/max won't compare them as strings
Yuya Nishihara <yuya@tcha.org>
parents:
34541
diff
changeset
|
523 10 |
ee0d74083a22
templater: store revisions as ints so min/max won't compare them as strings
Yuya Nishihara <yuya@tcha.org>
parents:
34541
diff
changeset
|
524 |
37499
75c13343cf38
templater: wrap result of '%' operation so it never looks like a thunk
Yuya Nishihara <yuya@tcha.org>
parents:
37418
diff
changeset
|
525 Test min/max over map operation: |
75c13343cf38
templater: wrap result of '%' operation so it never looks like a thunk
Yuya Nishihara <yuya@tcha.org>
parents:
37418
diff
changeset
|
526 |
75c13343cf38
templater: wrap result of '%' operation so it never looks like a thunk
Yuya Nishihara <yuya@tcha.org>
parents:
37418
diff
changeset
|
527 $ hg log -R latesttag -r3 -T '{min(tags % "{tag}")}\n' |
75c13343cf38
templater: wrap result of '%' operation so it never looks like a thunk
Yuya Nishihara <yuya@tcha.org>
parents:
37418
diff
changeset
|
528 at3 |
75c13343cf38
templater: wrap result of '%' operation so it never looks like a thunk
Yuya Nishihara <yuya@tcha.org>
parents:
37418
diff
changeset
|
529 $ hg log -R latesttag -r3 -T '{max(tags % "{tag}")}\n' |
75c13343cf38
templater: wrap result of '%' operation so it never looks like a thunk
Yuya Nishihara <yuya@tcha.org>
parents:
37418
diff
changeset
|
530 t3 |
75c13343cf38
templater: wrap result of '%' operation so it never looks like a thunk
Yuya Nishihara <yuya@tcha.org>
parents:
37418
diff
changeset
|
531 |
38265
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
532 Test min/max of strings: |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
533 |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
534 $ hg log -R latesttag -l1 -T '{min(desc)}\n' |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
535 3 |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
536 $ hg log -R latesttag -l1 -T '{max(desc)}\n' |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
537 t |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
538 |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
539 Test min/max of non-iterable: |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
540 |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
541 $ hg debugtemplate '{min(1)}' |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
542 hg: parse error: 1 is not iterable |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
543 (min first argument should be an iterable) |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
544 [10] |
38265
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
545 $ hg debugtemplate '{max(2)}' |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
546 hg: parse error: 2 is not iterable |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
547 (max first argument should be an iterable) |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
548 [10] |
38265
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
549 |
38285
8d6109b49b31
templater: introduce a wrapper for date tuple (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
38277
diff
changeset
|
550 $ hg log -R latesttag -l1 -T '{min(date)}' |
8d6109b49b31
templater: introduce a wrapper for date tuple (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
38277
diff
changeset
|
551 hg: parse error: date is not iterable |
8d6109b49b31
templater: introduce a wrapper for date tuple (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
38277
diff
changeset
|
552 (min first argument should be an iterable) |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
553 [10] |
38285
8d6109b49b31
templater: introduce a wrapper for date tuple (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
38277
diff
changeset
|
554 $ hg log -R latesttag -l1 -T '{max(date)}' |
8d6109b49b31
templater: introduce a wrapper for date tuple (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
38277
diff
changeset
|
555 hg: parse error: date is not iterable |
8d6109b49b31
templater: introduce a wrapper for date tuple (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
38277
diff
changeset
|
556 (max first argument should be an iterable) |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
557 [10] |
38285
8d6109b49b31
templater: introduce a wrapper for date tuple (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
38277
diff
changeset
|
558 |
38265
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
559 Test min/max of empty sequence: |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
560 |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
561 $ hg debugtemplate '{min("")}' |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
562 hg: parse error: empty string |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
563 (min first argument should be an iterable) |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
564 [10] |
38265
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
565 $ hg debugtemplate '{max("")}' |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
566 hg: parse error: empty string |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
567 (max first argument should be an iterable) |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
568 [10] |
38265
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
569 $ hg debugtemplate '{min(dict())}' |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
570 hg: parse error: empty sequence |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
571 (min first argument should be an iterable) |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
572 [10] |
38265
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
573 $ hg debugtemplate '{max(dict())}' |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
574 hg: parse error: empty sequence |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
575 (max first argument should be an iterable) |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
576 [10] |
38265
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
577 $ hg debugtemplate '{min(dict() % "")}' |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
578 hg: parse error: empty sequence |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
579 (min first argument should be an iterable) |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
580 [10] |
38265
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
581 $ hg debugtemplate '{max(dict() % "")}' |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
582 hg: parse error: empty sequence |
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
583 (max first argument should be an iterable) |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
584 [10] |
38265
41ae9b3cbfb9
templater: abstract min/max away
Yuya Nishihara <yuya@tcha.org>
parents:
38243
diff
changeset
|
585 |
37015
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
586 Test min/max of if() result |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
587 |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
588 $ cd latesttag |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
589 $ hg log -l1 -T '{min(if(true, revset("9:10"), ""))}\n' |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
590 9 |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
591 $ hg log -l1 -T '{max(if(false, "", revset("9:10")))}\n' |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
592 10 |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
593 $ hg log -l1 -T '{min(ifcontains("a", "aa", revset("9:10"), ""))}\n' |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
594 9 |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
595 $ hg log -l1 -T '{max(ifcontains("a", "bb", "", revset("9:10")))}\n' |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
596 10 |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
597 $ hg log -l1 -T '{min(ifeq(0, 0, revset("9:10"), ""))}\n' |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
598 9 |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
599 $ hg log -l1 -T '{max(ifeq(0, 1, "", revset("9:10")))}\n' |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
600 10 |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
601 $ cd .. |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
602 |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
603 Test laziness of if() then/else clause |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
604 |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
605 $ hg debugtemplate '{count(0)}' |
37229
05db42732fce
templatefilters: handle TypeError by count()
Yuya Nishihara <yuya@tcha.org>
parents:
37227
diff
changeset
|
606 hg: parse error: not countable |
05db42732fce
templatefilters: handle TypeError by count()
Yuya Nishihara <yuya@tcha.org>
parents:
37227
diff
changeset
|
607 (incompatible use of template filter 'count') |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
608 [10] |
37015
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
609 $ hg debugtemplate '{if(true, "", count(0))}' |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
610 $ hg debugtemplate '{if(false, count(0), "")}' |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
611 $ hg debugtemplate '{ifcontains("a", "aa", "", count(0))}' |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
612 $ hg debugtemplate '{ifcontains("a", "bb", count(0), "")}' |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
613 $ hg debugtemplate '{ifeq(0, 0, "", count(0))}' |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
614 $ hg debugtemplate '{ifeq(0, 1, count(0), "")}' |
a318bb154d42
templatefuncs: do not stringify result of if*() expression
Yuya Nishihara <yuya@tcha.org>
parents:
36691
diff
changeset
|
615 |
40934
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
616 Test search() function: |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
617 |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
618 $ hg log -R a -r2 -T '{desc}\n' |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
619 no person |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
620 |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
621 $ hg log -R a -r2 -T '{search(r"p.*", desc)}\n' |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
622 person |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
623 |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
624 as bool |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
625 |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
626 $ hg log -R a -r2 -T '{if(search(r"p.*", desc), "", "not ")}found\n' |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
627 found |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
628 $ hg log -R a -r2 -T '{if(search(r"q", desc), "", "not ")}found\n' |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
629 not found |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
630 |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
631 match as json |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
632 |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
633 $ hg log -R a -r2 -T '{search(r"(no) p.*", desc)|json}\n' |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
634 {"0": "no person", "1": "no"} |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
635 $ hg log -R a -r2 -T '{search(r"q", desc)|json}\n' |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
636 null |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
637 |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
638 group reference |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
639 |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
640 $ hg log -R a -r2 -T '{search(r"(no) (p.*)", desc) % "{1|upper} {2|hex}"}\n' |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
641 NO 706572736f6e |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
642 $ hg log -R a -r2 -T '{search(r"(?P<foo>[a-z]*)", desc) % "{foo}"}\n' |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
643 no |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
644 $ hg log -R a -r2 -T '{search(r"(?P<foo>[a-z]*)", desc).foo}\n' |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
645 no |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
646 |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
647 group reference with no match |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
648 |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
649 $ hg log -R a -r2 -T '{search(r"q", desc) % "match: {0}"}\n' |
40935
4591c9791a82
templatefuncs: specialize "no match" value of search() to allow % operation
Yuya Nishihara <yuya@tcha.org>
parents:
40934
diff
changeset
|
650 |
40934
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
651 |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
652 bad group names |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
653 |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
654 $ hg log -R a -r2 -T '{search(r"(?P<0>.)", desc) % "{0}"}\n' |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
655 hg: parse error: search got an invalid pattern: (?P<0>.) |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
656 [10] |
40934
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
657 $ hg log -R a -r2 -T '{search(r"(?P<repo>.)", desc) % "{repo}"}\n' |
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
658 hg: parse error: invalid group 'repo' in search pattern: (?P<repo>.) |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
659 [10] |
40934
d3e688b9ef2e
templatefuncs: add regexp search() function that extracts substring
Yuya Nishihara <yuya@tcha.org>
parents:
40341
diff
changeset
|
660 |
19058
d8d548d868d3
template: call runtemplate on the src argument to sub
Sean Farley <sean.michael.farley@gmail.com>
parents:
18970
diff
changeset
|
661 Test the sub function of templating for expansion: |
d8d548d868d3
template: call runtemplate on the src argument to sub
Sean Farley <sean.michael.farley@gmail.com>
parents:
18970
diff
changeset
|
662 |
d8d548d868d3
template: call runtemplate on the src argument to sub
Sean Farley <sean.michael.farley@gmail.com>
parents:
18970
diff
changeset
|
663 $ hg log -R latesttag -r 10 --template '{sub("[0-9]", "x", "{rev}")}\n' |
d8d548d868d3
template: call runtemplate on the src argument to sub
Sean Farley <sean.michael.farley@gmail.com>
parents:
18970
diff
changeset
|
664 xx |
19330
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
665 |
26188
662ea52d5dca
templater: catch regexp error at sub() function
Yuya Nishihara <yuya@tcha.org>
parents:
26128
diff
changeset
|
666 $ hg log -R latesttag -r 10 -T '{sub("[", "x", rev)}\n' |
662ea52d5dca
templater: catch regexp error at sub() function
Yuya Nishihara <yuya@tcha.org>
parents:
26128
diff
changeset
|
667 hg: parse error: sub got an invalid pattern: [ |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
668 [10] |
26188
662ea52d5dca
templater: catch regexp error at sub() function
Yuya Nishihara <yuya@tcha.org>
parents:
26128
diff
changeset
|
669 $ hg log -R latesttag -r 10 -T '{sub("[0-9]", r"\1", rev)}\n' |
662ea52d5dca
templater: catch regexp error at sub() function
Yuya Nishihara <yuya@tcha.org>
parents:
26128
diff
changeset
|
670 hg: parse error: sub got an invalid replacement: \1 |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
671 [10] |
26188
662ea52d5dca
templater: catch regexp error at sub() function
Yuya Nishihara <yuya@tcha.org>
parents:
26128
diff
changeset
|
672 |
19330
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
673 Test the strip function with chars specified: |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
674 |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
675 $ hg log -R latesttag --template '{desc}\n' |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
676 at3 |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
677 t5 |
33862
fb672eac2702
templatekw: choose {latesttag} by len(changes), not date (issue5659)
Martin von Zweigbergk <martinvonz@google.com>
parents:
33861
diff
changeset
|
678 t4 |
19330
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
679 t3 |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
680 t2 |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
681 t1 |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
682 merge |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
683 h2e |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
684 h2d |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
685 h1c |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
686 b |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
687 a |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
688 |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
689 $ hg log -R latesttag --template '{strip(desc, "te")}\n' |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
690 at3 |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
691 5 |
33862
fb672eac2702
templatekw: choose {latesttag} by len(changes), not date (issue5659)
Martin von Zweigbergk <martinvonz@google.com>
parents:
33861
diff
changeset
|
692 4 |
19330
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
693 3 |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
694 2 |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
695 1 |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
696 merg |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
697 h2 |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
698 h2d |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
699 h1c |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
700 b |
867b9957d895
templater: add strip function with chars as an extra argument
Alexander Plavin <me@aplavin.ru>
parents:
19127
diff
changeset
|
701 a |
20066
64b4f0cd7336
templater: fix escaping in nested string literals (issue4102)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
702 |
19989
c38c3fdc8b93
date: allow %z in format (issue4040)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
703 Test date format: |
c38c3fdc8b93
date: allow %z in format (issue4040)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
704 |
c38c3fdc8b93
date: allow %z in format (issue4040)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
705 $ hg log -R latesttag --template 'date: {date(date, "%y %m %d %S %z")}\n' |
c38c3fdc8b93
date: allow %z in format (issue4040)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
706 date: 70 01 01 10 +0000 |
c38c3fdc8b93
date: allow %z in format (issue4040)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
707 date: 70 01 01 09 +0000 |
33862
fb672eac2702
templatekw: choose {latesttag} by len(changes), not date (issue5659)
Martin von Zweigbergk <martinvonz@google.com>
parents:
33861
diff
changeset
|
708 date: 70 01 01 04 +0000 |
19989
c38c3fdc8b93
date: allow %z in format (issue4040)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
709 date: 70 01 01 08 +0000 |
c38c3fdc8b93
date: allow %z in format (issue4040)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
710 date: 70 01 01 07 +0000 |
c38c3fdc8b93
date: allow %z in format (issue4040)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
711 date: 70 01 01 06 +0000 |
c38c3fdc8b93
date: allow %z in format (issue4040)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
712 date: 70 01 01 05 +0100 |
c38c3fdc8b93
date: allow %z in format (issue4040)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
713 date: 70 01 01 04 +0000 |
c38c3fdc8b93
date: allow %z in format (issue4040)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
714 date: 70 01 01 03 +0000 |
c38c3fdc8b93
date: allow %z in format (issue4040)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
715 date: 70 01 01 02 +0000 |
c38c3fdc8b93
date: allow %z in format (issue4040)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
716 date: 70 01 01 01 +0000 |
c38c3fdc8b93
date: allow %z in format (issue4040)
Matt Mackall <mpm@selenic.com>
parents:
19770
diff
changeset
|
717 date: 70 01 01 00 +0000 |
20072 | 718 |
24903
09124cce913f
templater: fix crash by passing invalid object to date() function
Yuya Nishihara <yuya@tcha.org>
parents:
24886
diff
changeset
|
719 Test invalid date: |
09124cce913f
templater: fix crash by passing invalid object to date() function
Yuya Nishihara <yuya@tcha.org>
parents:
24886
diff
changeset
|
720 |
09124cce913f
templater: fix crash by passing invalid object to date() function
Yuya Nishihara <yuya@tcha.org>
parents:
24886
diff
changeset
|
721 $ hg log -R latesttag -T '{date(rev)}\n' |
09124cce913f
templater: fix crash by passing invalid object to date() function
Yuya Nishihara <yuya@tcha.org>
parents:
24886
diff
changeset
|
722 hg: parse error: date expects a date information |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
723 [10] |
24903
09124cce913f
templater: fix crash by passing invalid object to date() function
Yuya Nishihara <yuya@tcha.org>
parents:
24886
diff
changeset
|
724 |
38434
70f551a3f52e
tests: extract test-template-functions.t from test-command-template.t
Yuya Nishihara <yuya@tcha.org>
parents:
38433
diff
changeset
|
725 Set up repository containing template fragments in commit metadata: |
20067
3d8bfe2ecf6d
templater: only recursively evaluate string literals as templates (issue4103)
Matt Mackall <mpm@selenic.com>
parents:
20066
diff
changeset
|
726 |
3d8bfe2ecf6d
templater: only recursively evaluate string literals as templates (issue4103)
Matt Mackall <mpm@selenic.com>
parents:
20066
diff
changeset
|
727 $ hg init r |
3d8bfe2ecf6d
templater: only recursively evaluate string literals as templates (issue4103)
Matt Mackall <mpm@selenic.com>
parents:
20066
diff
changeset
|
728 $ cd r |
3d8bfe2ecf6d
templater: only recursively evaluate string literals as templates (issue4103)
Matt Mackall <mpm@selenic.com>
parents:
20066
diff
changeset
|
729 $ echo a > a |
3d8bfe2ecf6d
templater: only recursively evaluate string literals as templates (issue4103)
Matt Mackall <mpm@selenic.com>
parents:
20066
diff
changeset
|
730 $ hg ci -Am '{rev}' |
3d8bfe2ecf6d
templater: only recursively evaluate string literals as templates (issue4103)
Matt Mackall <mpm@selenic.com>
parents:
20066
diff
changeset
|
731 adding a |
20076
faa4b3fc4197
templater: makes branches work correctly with stringify (issue4108)
Matt Mackall <mpm@selenic.com>
parents:
20067
diff
changeset
|
732 |
20661
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
733 $ 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
|
734 $ echo aa >> aa |
7e627fe63e5e
templater: avoid recursive evaluation of string literals completely
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20079
diff
changeset
|
735 $ 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
|
736 |
28373
9a9dd71e882c
templater: make label() take unknown symbol as color literal
Yuya Nishihara <yuya@tcha.org>
parents:
28349
diff
changeset
|
737 color effect can be specified without quoting: |
9a9dd71e882c
templater: make label() take unknown symbol as color literal
Yuya Nishihara <yuya@tcha.org>
parents:
28349
diff
changeset
|
738 |
9a9dd71e882c
templater: make label() take unknown symbol as color literal
Yuya Nishihara <yuya@tcha.org>
parents:
28349
diff
changeset
|
739 $ hg log --color=always -l 1 --template '{label(red, "text\n")}' |
9a9dd71e882c
templater: make label() take unknown symbol as color literal
Yuya Nishihara <yuya@tcha.org>
parents:
28349
diff
changeset
|
740 \x1b[0;31mtext\x1b[0m (esc) |
9a9dd71e882c
templater: make label() take unknown symbol as color literal
Yuya Nishihara <yuya@tcha.org>
parents:
28349
diff
changeset
|
741 |
31518
43d6ef658874
color: insert color code after every "\e[0m" (issue5413)
Yuya Nishihara <yuya@tcha.org>
parents:
30732
diff
changeset
|
742 color effects can be nested (issue5413) |
43d6ef658874
color: insert color code after every "\e[0m" (issue5413)
Yuya Nishihara <yuya@tcha.org>
parents:
30732
diff
changeset
|
743 |
43d6ef658874
color: insert color code after every "\e[0m" (issue5413)
Yuya Nishihara <yuya@tcha.org>
parents:
30732
diff
changeset
|
744 $ hg debugtemplate --color=always \ |
43d6ef658874
color: insert color code after every "\e[0m" (issue5413)
Yuya Nishihara <yuya@tcha.org>
parents:
30732
diff
changeset
|
745 > '{label(red, "red{label(magenta, "ma{label(cyan, "cyan")}{label(yellow, "yellow")}genta")}")}\n' |
43d6ef658874
color: insert color code after every "\e[0m" (issue5413)
Yuya Nishihara <yuya@tcha.org>
parents:
30732
diff
changeset
|
746 \x1b[0;31mred\x1b[0;35mma\x1b[0;36mcyan\x1b[0m\x1b[0;31m\x1b[0;35m\x1b[0;33myellow\x1b[0m\x1b[0;31m\x1b[0;35mgenta\x1b[0m (esc) |
43d6ef658874
color: insert color code after every "\e[0m" (issue5413)
Yuya Nishihara <yuya@tcha.org>
parents:
30732
diff
changeset
|
747 |
31521
44c591f63458
templater: make pad() strip color codes before computing width (issue5416)
Yuya Nishihara <yuya@tcha.org>
parents:
31520
diff
changeset
|
748 pad() should interact well with color codes (issue5416) |
44c591f63458
templater: make pad() strip color codes before computing width (issue5416)
Yuya Nishihara <yuya@tcha.org>
parents:
31520
diff
changeset
|
749 |
44c591f63458
templater: make pad() strip color codes before computing width (issue5416)
Yuya Nishihara <yuya@tcha.org>
parents:
31520
diff
changeset
|
750 $ hg debugtemplate --color=always \ |
44c591f63458
templater: make pad() strip color codes before computing width (issue5416)
Yuya Nishihara <yuya@tcha.org>
parents:
31520
diff
changeset
|
751 > '{pad(label(red, "red"), 5, label(cyan, "-"))}\n' |
44c591f63458
templater: make pad() strip color codes before computing width (issue5416)
Yuya Nishihara <yuya@tcha.org>
parents:
31520
diff
changeset
|
752 \x1b[0;31mred\x1b[0m\x1b[0;36m-\x1b[0m\x1b[0;36m-\x1b[0m (esc) |
44c591f63458
templater: make pad() strip color codes before computing width (issue5416)
Yuya Nishihara <yuya@tcha.org>
parents:
31520
diff
changeset
|
753 |
40189
9458dbfa7f33
templatefuncs: add truncate parameter to pad
Mark Thomas <mbthomas@fb.com>
parents:
39707
diff
changeset
|
754 pad() with truncate has to strip color codes, though |
9458dbfa7f33
templatefuncs: add truncate parameter to pad
Mark Thomas <mbthomas@fb.com>
parents:
39707
diff
changeset
|
755 |
9458dbfa7f33
templatefuncs: add truncate parameter to pad
Mark Thomas <mbthomas@fb.com>
parents:
39707
diff
changeset
|
756 $ hg debugtemplate --color=always \ |
9458dbfa7f33
templatefuncs: add truncate parameter to pad
Mark Thomas <mbthomas@fb.com>
parents:
39707
diff
changeset
|
757 > '{pad(label(red, "scarlet"), 5, truncate=true)}\n' |
9458dbfa7f33
templatefuncs: add truncate parameter to pad
Mark Thomas <mbthomas@fb.com>
parents:
39707
diff
changeset
|
758 scarl |
9458dbfa7f33
templatefuncs: add truncate parameter to pad
Mark Thomas <mbthomas@fb.com>
parents:
39707
diff
changeset
|
759 |
28374
af3bd9d1dbc1
templater: move label() function from color extension
Yuya Nishihara <yuya@tcha.org>
parents:
28373
diff
changeset
|
760 label should be no-op if color is disabled: |
af3bd9d1dbc1
templater: move label() function from color extension
Yuya Nishihara <yuya@tcha.org>
parents:
28373
diff
changeset
|
761 |
af3bd9d1dbc1
templater: move label() function from color extension
Yuya Nishihara <yuya@tcha.org>
parents:
28373
diff
changeset
|
762 $ hg log --color=never -l 1 --template '{label(red, "text\n")}' |
af3bd9d1dbc1
templater: move label() function from color extension
Yuya Nishihara <yuya@tcha.org>
parents:
28373
diff
changeset
|
763 text |
af3bd9d1dbc1
templater: move label() function from color extension
Yuya Nishihara <yuya@tcha.org>
parents:
28373
diff
changeset
|
764 $ hg log --config extensions.color=! -l 1 --template '{label(red, "text\n")}' |
af3bd9d1dbc1
templater: move label() function from color extension
Yuya Nishihara <yuya@tcha.org>
parents:
28373
diff
changeset
|
765 text |
af3bd9d1dbc1
templater: move label() function from color extension
Yuya Nishihara <yuya@tcha.org>
parents:
28373
diff
changeset
|
766 |
20076
faa4b3fc4197
templater: makes branches work correctly with stringify (issue4108)
Matt Mackall <mpm@selenic.com>
parents:
20067
diff
changeset
|
767 Test branches inside if statement: |
faa4b3fc4197
templater: makes branches work correctly with stringify (issue4108)
Matt Mackall <mpm@selenic.com>
parents:
20067
diff
changeset
|
768 |
faa4b3fc4197
templater: makes branches work correctly with stringify (issue4108)
Matt Mackall <mpm@selenic.com>
parents:
20067
diff
changeset
|
769 $ hg log -r 0 --template '{if(branches, "yes", "no")}\n' |
faa4b3fc4197
templater: makes branches work correctly with stringify (issue4108)
Matt Mackall <mpm@selenic.com>
parents:
20067
diff
changeset
|
770 no |
20662
a54c0d830499
templater: apply "stringify()" on sub expression to get string correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20661
diff
changeset
|
771 |
31926
932241b8c644
templater: add dict() constructor
Yuya Nishihara <yuya@tcha.org>
parents:
31887
diff
changeset
|
772 Test dict constructor: |
932241b8c644
templater: add dict() constructor
Yuya Nishihara <yuya@tcha.org>
parents:
31887
diff
changeset
|
773 |
932241b8c644
templater: add dict() constructor
Yuya Nishihara <yuya@tcha.org>
parents:
31887
diff
changeset
|
774 $ hg log -r 0 -T '{dict(y=node|short, x=rev)}\n' |
932241b8c644
templater: add dict() constructor
Yuya Nishihara <yuya@tcha.org>
parents:
31887
diff
changeset
|
775 y=f7769ec2ab97 x=0 |
932241b8c644
templater: add dict() constructor
Yuya Nishihara <yuya@tcha.org>
parents:
31887
diff
changeset
|
776 $ hg log -r 0 -T '{dict(x=rev, y=node|short) % "{key}={value}\n"}' |
932241b8c644
templater: add dict() constructor
Yuya Nishihara <yuya@tcha.org>
parents:
31887
diff
changeset
|
777 x=0 |
932241b8c644
templater: add dict() constructor
Yuya Nishihara <yuya@tcha.org>
parents:
31887
diff
changeset
|
778 y=f7769ec2ab97 |
932241b8c644
templater: add dict() constructor
Yuya Nishihara <yuya@tcha.org>
parents:
31887
diff
changeset
|
779 $ hg log -r 0 -T '{dict(x=rev, y=node|short)|json}\n' |
932241b8c644
templater: add dict() constructor
Yuya Nishihara <yuya@tcha.org>
parents:
31887
diff
changeset
|
780 {"x": 0, "y": "f7769ec2ab97"} |
932241b8c644
templater: add dict() constructor
Yuya Nishihara <yuya@tcha.org>
parents:
31887
diff
changeset
|
781 $ hg log -r 0 -T '{dict()|json}\n' |
932241b8c644
templater: add dict() constructor
Yuya Nishihara <yuya@tcha.org>
parents:
31887
diff
changeset
|
782 {} |
932241b8c644
templater: add dict() constructor
Yuya Nishihara <yuya@tcha.org>
parents:
31887
diff
changeset
|
783 |
31928
277b3e2d711b
templater: add shorthand for building a dict like {"key": key}
Yuya Nishihara <yuya@tcha.org>
parents:
31927
diff
changeset
|
784 $ hg log -r 0 -T '{dict(rev, node=node|short)}\n' |
277b3e2d711b
templater: add shorthand for building a dict like {"key": key}
Yuya Nishihara <yuya@tcha.org>
parents:
31927
diff
changeset
|
785 rev=0 node=f7769ec2ab97 |
277b3e2d711b
templater: add shorthand for building a dict like {"key": key}
Yuya Nishihara <yuya@tcha.org>
parents:
31927
diff
changeset
|
786 $ hg log -r 0 -T '{dict(rev, node|short)}\n' |
277b3e2d711b
templater: add shorthand for building a dict like {"key": key}
Yuya Nishihara <yuya@tcha.org>
parents:
31927
diff
changeset
|
787 rev=0 node=f7769ec2ab97 |
277b3e2d711b
templater: add shorthand for building a dict like {"key": key}
Yuya Nishihara <yuya@tcha.org>
parents:
31927
diff
changeset
|
788 |
277b3e2d711b
templater: add shorthand for building a dict like {"key": key}
Yuya Nishihara <yuya@tcha.org>
parents:
31927
diff
changeset
|
789 $ hg log -r 0 -T '{dict(rev, rev=rev)}\n' |
277b3e2d711b
templater: add shorthand for building a dict like {"key": key}
Yuya Nishihara <yuya@tcha.org>
parents:
31927
diff
changeset
|
790 hg: parse error: duplicated dict key 'rev' inferred |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
791 [10] |
31928
277b3e2d711b
templater: add shorthand for building a dict like {"key": key}
Yuya Nishihara <yuya@tcha.org>
parents:
31927
diff
changeset
|
792 $ hg log -r 0 -T '{dict(node, node|short)}\n' |
277b3e2d711b
templater: add shorthand for building a dict like {"key": key}
Yuya Nishihara <yuya@tcha.org>
parents:
31927
diff
changeset
|
793 hg: parse error: duplicated dict key 'node' inferred |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
794 [10] |
31928
277b3e2d711b
templater: add shorthand for building a dict like {"key": key}
Yuya Nishihara <yuya@tcha.org>
parents:
31927
diff
changeset
|
795 $ hg log -r 0 -T '{dict(1 + 2)}' |
277b3e2d711b
templater: add shorthand for building a dict like {"key": key}
Yuya Nishihara <yuya@tcha.org>
parents:
31927
diff
changeset
|
796 hg: parse error: dict key cannot be inferred |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
797 [10] |
31928
277b3e2d711b
templater: add shorthand for building a dict like {"key": key}
Yuya Nishihara <yuya@tcha.org>
parents:
31927
diff
changeset
|
798 |
31926
932241b8c644
templater: add dict() constructor
Yuya Nishihara <yuya@tcha.org>
parents:
31887
diff
changeset
|
799 $ hg log -r 0 -T '{dict(x=rev, x=node)}' |
932241b8c644
templater: add dict() constructor
Yuya Nishihara <yuya@tcha.org>
parents:
31887
diff
changeset
|
800 hg: parse error: dict got multiple values for keyword argument 'x' |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
801 [10] |
31926
932241b8c644
templater: add dict() constructor
Yuya Nishihara <yuya@tcha.org>
parents:
31887
diff
changeset
|
802 |
24241
e7baf88c29c3
templatekw: forward _hybrid.get to raw values so that get(extras, key) works
Yuya Nishihara <yuya@tcha.org>
parents:
24240
diff
changeset
|
803 Test get function: |
e7baf88c29c3
templatekw: forward _hybrid.get to raw values so that get(extras, key) works
Yuya Nishihara <yuya@tcha.org>
parents:
24240
diff
changeset
|
804 |
e7baf88c29c3
templatekw: forward _hybrid.get to raw values so that get(extras, key) works
Yuya Nishihara <yuya@tcha.org>
parents:
24240
diff
changeset
|
805 $ hg log -r 0 --template '{get(extras, "branch")}\n' |
e7baf88c29c3
templatekw: forward _hybrid.get to raw values so that get(extras, key) works
Yuya Nishihara <yuya@tcha.org>
parents:
24240
diff
changeset
|
806 default |
28331
2874db5462d3
templater: fix get() to evaluate arguments eagerly
Yuya Nishihara <yuya@tcha.org>
parents:
28270
diff
changeset
|
807 $ hg log -r 0 --template '{get(extras, "br{"anch"}")}\n' |
2874db5462d3
templater: fix get() to evaluate arguments eagerly
Yuya Nishihara <yuya@tcha.org>
parents:
28270
diff
changeset
|
808 default |
24241
e7baf88c29c3
templatekw: forward _hybrid.get to raw values so that get(extras, key) works
Yuya Nishihara <yuya@tcha.org>
parents:
24240
diff
changeset
|
809 $ hg log -r 0 --template '{get(files, "should_fail")}\n' |
38243
06d11cd90516
templater: promote getmember() to an interface of wrapped types
Yuya Nishihara <yuya@tcha.org>
parents:
38229
diff
changeset
|
810 hg: parse error: not a dictionary |
06d11cd90516
templater: promote getmember() to an interface of wrapped types
Yuya Nishihara <yuya@tcha.org>
parents:
38229
diff
changeset
|
811 (get() expects a dict as first argument) |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
812 [10] |
24241
e7baf88c29c3
templatekw: forward _hybrid.get to raw values so that get(extras, key) works
Yuya Nishihara <yuya@tcha.org>
parents:
24240
diff
changeset
|
813 |
38285
8d6109b49b31
templater: introduce a wrapper for date tuple (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
38277
diff
changeset
|
814 Test json filter applied to wrapped object: |
31882
ba5b74f780d5
templater: make _hybrid provide more list/dict-like methods
Yuya Nishihara <yuya@tcha.org>
parents:
31807
diff
changeset
|
815 |
ba5b74f780d5
templater: make _hybrid provide more list/dict-like methods
Yuya Nishihara <yuya@tcha.org>
parents:
31807
diff
changeset
|
816 $ hg log -r0 -T '{files|json}\n' |
ba5b74f780d5
templater: make _hybrid provide more list/dict-like methods
Yuya Nishihara <yuya@tcha.org>
parents:
31807
diff
changeset
|
817 ["a"] |
ba5b74f780d5
templater: make _hybrid provide more list/dict-like methods
Yuya Nishihara <yuya@tcha.org>
parents:
31807
diff
changeset
|
818 $ hg log -r0 -T '{extras|json}\n' |
ba5b74f780d5
templater: make _hybrid provide more list/dict-like methods
Yuya Nishihara <yuya@tcha.org>
parents:
31807
diff
changeset
|
819 {"branch": "default"} |
38285
8d6109b49b31
templater: introduce a wrapper for date tuple (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
38277
diff
changeset
|
820 $ hg log -r0 -T '{date|json}\n' |
8d6109b49b31
templater: introduce a wrapper for date tuple (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
38277
diff
changeset
|
821 [0, 0] |
44589
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
822 $ hg log -r0 -T '{revset(":")|json}\n' |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
823 [0, 1] |
31882
ba5b74f780d5
templater: make _hybrid provide more list/dict-like methods
Yuya Nishihara <yuya@tcha.org>
parents:
31807
diff
changeset
|
824 |
37499
75c13343cf38
templater: wrap result of '%' operation so it never looks like a thunk
Yuya Nishihara <yuya@tcha.org>
parents:
37418
diff
changeset
|
825 Test json filter applied to map result: |
75c13343cf38
templater: wrap result of '%' operation so it never looks like a thunk
Yuya Nishihara <yuya@tcha.org>
parents:
37418
diff
changeset
|
826 |
75c13343cf38
templater: wrap result of '%' operation so it never looks like a thunk
Yuya Nishihara <yuya@tcha.org>
parents:
37418
diff
changeset
|
827 $ hg log -r0 -T '{json(extras % "{key}")}\n' |
75c13343cf38
templater: wrap result of '%' operation so it never looks like a thunk
Yuya Nishihara <yuya@tcha.org>
parents:
37418
diff
changeset
|
828 ["branch"] |
75c13343cf38
templater: wrap result of '%' operation so it never looks like a thunk
Yuya Nishihara <yuya@tcha.org>
parents:
37418
diff
changeset
|
829 |
26128
51f6940d3b4f
templater: add optional timezone argument to localdate()
Yuya Nishihara <yuya@tcha.org>
parents:
26127
diff
changeset
|
830 Test localdate(date, tz) function: |
51f6940d3b4f
templater: add optional timezone argument to localdate()
Yuya Nishihara <yuya@tcha.org>
parents:
26127
diff
changeset
|
831 |
51f6940d3b4f
templater: add optional timezone argument to localdate()
Yuya Nishihara <yuya@tcha.org>
parents:
26127
diff
changeset
|
832 $ TZ=JST-09 hg log -r0 -T '{date|localdate|isodate}\n' |
51f6940d3b4f
templater: add optional timezone argument to localdate()
Yuya Nishihara <yuya@tcha.org>
parents:
26127
diff
changeset
|
833 1970-01-01 09:00 +0900 |
51f6940d3b4f
templater: add optional timezone argument to localdate()
Yuya Nishihara <yuya@tcha.org>
parents:
26127
diff
changeset
|
834 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "UTC")|isodate}\n' |
51f6940d3b4f
templater: add optional timezone argument to localdate()
Yuya Nishihara <yuya@tcha.org>
parents:
26127
diff
changeset
|
835 1970-01-01 00:00 +0000 |
29636
84ef4517de03
date: refactor timezone parsing
Matt Mackall <mpm@selenic.com>
parents:
29624
diff
changeset
|
836 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "blahUTC")|isodate}\n' |
84ef4517de03
date: refactor timezone parsing
Matt Mackall <mpm@selenic.com>
parents:
29624
diff
changeset
|
837 hg: parse error: localdate expects a timezone |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
838 [10] |
26128
51f6940d3b4f
templater: add optional timezone argument to localdate()
Yuya Nishihara <yuya@tcha.org>
parents:
26127
diff
changeset
|
839 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "+0200")|isodate}\n' |
51f6940d3b4f
templater: add optional timezone argument to localdate()
Yuya Nishihara <yuya@tcha.org>
parents:
26127
diff
changeset
|
840 1970-01-01 02:00 +0200 |
51f6940d3b4f
templater: add optional timezone argument to localdate()
Yuya Nishihara <yuya@tcha.org>
parents:
26127
diff
changeset
|
841 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "0")|isodate}\n' |
51f6940d3b4f
templater: add optional timezone argument to localdate()
Yuya Nishihara <yuya@tcha.org>
parents:
26127
diff
changeset
|
842 1970-01-01 00:00 +0000 |
51f6940d3b4f
templater: add optional timezone argument to localdate()
Yuya Nishihara <yuya@tcha.org>
parents:
26127
diff
changeset
|
843 $ TZ=JST-09 hg log -r0 -T '{localdate(date, 0)|isodate}\n' |
51f6940d3b4f
templater: add optional timezone argument to localdate()
Yuya Nishihara <yuya@tcha.org>
parents:
26127
diff
changeset
|
844 1970-01-01 00:00 +0000 |
51f6940d3b4f
templater: add optional timezone argument to localdate()
Yuya Nishihara <yuya@tcha.org>
parents:
26127
diff
changeset
|
845 $ hg log -r0 -T '{localdate(date, "invalid")|isodate}\n' |
51f6940d3b4f
templater: add optional timezone argument to localdate()
Yuya Nishihara <yuya@tcha.org>
parents:
26127
diff
changeset
|
846 hg: parse error: localdate expects a timezone |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
847 [10] |
26128
51f6940d3b4f
templater: add optional timezone argument to localdate()
Yuya Nishihara <yuya@tcha.org>
parents:
26127
diff
changeset
|
848 $ hg log -r0 -T '{localdate(date, date)|isodate}\n' |
51f6940d3b4f
templater: add optional timezone argument to localdate()
Yuya Nishihara <yuya@tcha.org>
parents:
26127
diff
changeset
|
849 hg: parse error: localdate expects a timezone |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
850 [10] |
26128
51f6940d3b4f
templater: add optional timezone argument to localdate()
Yuya Nishihara <yuya@tcha.org>
parents:
26127
diff
changeset
|
851 |
20369
9c6b86dd2ed2
template: add shortest(node) template function
Durham Goode <durham@fb.com>
parents:
20079
diff
changeset
|
852 Test shortest(node) function: |
9c6b86dd2ed2
template: add shortest(node) template function
Durham Goode <durham@fb.com>
parents:
20079
diff
changeset
|
853 |
9c6b86dd2ed2
template: add shortest(node) template function
Durham Goode <durham@fb.com>
parents:
20079
diff
changeset
|
854 $ echo b > b |
9c6b86dd2ed2
template: add shortest(node) template function
Durham Goode <durham@fb.com>
parents:
20079
diff
changeset
|
855 $ hg ci -qAm b |
9c6b86dd2ed2
template: add shortest(node) template function
Durham Goode <durham@fb.com>
parents:
20079
diff
changeset
|
856 $ hg log --template '{shortest(node)}\n' |
20670 | 857 e777 |
858 bcc7 | |
20369
9c6b86dd2ed2
template: add shortest(node) template function
Durham Goode <durham@fb.com>
parents:
20079
diff
changeset
|
859 f776 |
9c6b86dd2ed2
template: add shortest(node) template function
Durham Goode <durham@fb.com>
parents:
20079
diff
changeset
|
860 $ hg log --template '{shortest(node, 10)}\n' |
20670 | 861 e777603221 |
862 bcc7ff960b | |
20369
9c6b86dd2ed2
template: add shortest(node) template function
Durham Goode <durham@fb.com>
parents:
20079
diff
changeset
|
863 f7769ec2ab |
40341
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
864 $ hg log --template '{shortest(node, 1)}\n' -r null |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
865 00 |
26105
d67341f55429
templater: introduce unified filter syntax for unary functions
Yuya Nishihara <yuya@tcha.org>
parents:
25862
diff
changeset
|
866 $ hg log --template '{node|shortest}\n' -l1 |
d67341f55429
templater: introduce unified filter syntax for unary functions
Yuya Nishihara <yuya@tcha.org>
parents:
25862
diff
changeset
|
867 e777 |
20370
aa51392da507
template: add pad function for padding output
Durham Goode <durham@fb.com>
parents:
20369
diff
changeset
|
868 |
28346
542d200bd261
templater: fix shortest() to evaluate int argument and handle error
Yuya Nishihara <yuya@tcha.org>
parents:
28345
diff
changeset
|
869 $ hg log -r 0 -T '{shortest(node, "1{"0"}")}\n' |
542d200bd261
templater: fix shortest() to evaluate int argument and handle error
Yuya Nishihara <yuya@tcha.org>
parents:
28345
diff
changeset
|
870 f7769ec2ab |
542d200bd261
templater: fix shortest() to evaluate int argument and handle error
Yuya Nishihara <yuya@tcha.org>
parents:
28345
diff
changeset
|
871 $ hg log -r 0 -T '{shortest(node, "not an int")}\n' |
542d200bd261
templater: fix shortest() to evaluate int argument and handle error
Yuya Nishihara <yuya@tcha.org>
parents:
28345
diff
changeset
|
872 hg: parse error: shortest() expects an integer minlength |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
873 [10] |
28346
542d200bd261
templater: fix shortest() to evaluate int argument and handle error
Yuya Nishihara <yuya@tcha.org>
parents:
28345
diff
changeset
|
874 |
32684
af854b1b36f8
revlog: add support for partial matching of wdir node id
Yuya Nishihara <yuya@tcha.org>
parents:
32039
diff
changeset
|
875 $ hg log -r 'wdir()' -T '{node|shortest}\n' |
af854b1b36f8
revlog: add support for partial matching of wdir node id
Yuya Nishihara <yuya@tcha.org>
parents:
32039
diff
changeset
|
876 ffff |
af854b1b36f8
revlog: add support for partial matching of wdir node id
Yuya Nishihara <yuya@tcha.org>
parents:
32039
diff
changeset
|
877 |
37709
7b2955624777
scmutil: make shortesthexnodeidprefix() take a full binary nodeid
Martin von Zweigbergk <martinvonz@google.com>
parents:
37499
diff
changeset
|
878 $ hg log --template '{shortest("f")}\n' -l1 |
7b2955624777
scmutil: make shortesthexnodeidprefix() take a full binary nodeid
Martin von Zweigbergk <martinvonz@google.com>
parents:
37499
diff
changeset
|
879 f |
7b2955624777
scmutil: make shortesthexnodeidprefix() take a full binary nodeid
Martin von Zweigbergk <martinvonz@google.com>
parents:
37499
diff
changeset
|
880 |
7b2955624777
scmutil: make shortesthexnodeidprefix() take a full binary nodeid
Martin von Zweigbergk <martinvonz@google.com>
parents:
37499
diff
changeset
|
881 $ hg log --template '{shortest("0123456789012345678901234567890123456789")}\n' -l1 |
7b2955624777
scmutil: make shortesthexnodeidprefix() take a full binary nodeid
Martin von Zweigbergk <martinvonz@google.com>
parents:
37499
diff
changeset
|
882 0123456789012345678901234567890123456789 |
7b2955624777
scmutil: make shortesthexnodeidprefix() take a full binary nodeid
Martin von Zweigbergk <martinvonz@google.com>
parents:
37499
diff
changeset
|
883 |
7b2955624777
scmutil: make shortesthexnodeidprefix() take a full binary nodeid
Martin von Zweigbergk <martinvonz@google.com>
parents:
37499
diff
changeset
|
884 $ hg log --template '{shortest("01234567890123456789012345678901234567890123456789")}\n' -l1 |
7b2955624777
scmutil: make shortesthexnodeidprefix() take a full binary nodeid
Martin von Zweigbergk <martinvonz@google.com>
parents:
37499
diff
changeset
|
885 01234567890123456789012345678901234567890123456789 |
7b2955624777
scmutil: make shortesthexnodeidprefix() take a full binary nodeid
Martin von Zweigbergk <martinvonz@google.com>
parents:
37499
diff
changeset
|
886 |
7b2955624777
scmutil: make shortesthexnodeidprefix() take a full binary nodeid
Martin von Zweigbergk <martinvonz@google.com>
parents:
37499
diff
changeset
|
887 $ hg log --template '{shortest("not a hex string")}\n' -l1 |
7b2955624777
scmutil: make shortesthexnodeidprefix() take a full binary nodeid
Martin von Zweigbergk <martinvonz@google.com>
parents:
37499
diff
changeset
|
888 not a hex string |
7b2955624777
scmutil: make shortesthexnodeidprefix() take a full binary nodeid
Martin von Zweigbergk <martinvonz@google.com>
parents:
37499
diff
changeset
|
889 |
7b2955624777
scmutil: make shortesthexnodeidprefix() take a full binary nodeid
Martin von Zweigbergk <martinvonz@google.com>
parents:
37499
diff
changeset
|
890 $ hg log --template '{shortest("not a hex string, but it'\''s 40 bytes long")}\n' -l1 |
7b2955624777
scmutil: make shortesthexnodeidprefix() take a full binary nodeid
Martin von Zweigbergk <martinvonz@google.com>
parents:
37499
diff
changeset
|
891 not a hex string, but it's 40 bytes long |
7b2955624777
scmutil: make shortesthexnodeidprefix() take a full binary nodeid
Martin von Zweigbergk <martinvonz@google.com>
parents:
37499
diff
changeset
|
892 |
37859
66dc9db6ed2c
shortest: make {shortest("fffffffff")} work again
Martin von Zweigbergk <martinvonz@google.com>
parents:
37772
diff
changeset
|
893 $ hg log --template '{shortest("ffffffffffffffffffffffffffffffffffffffff")}\n' -l1 |
66dc9db6ed2c
shortest: make {shortest("fffffffff")} work again
Martin von Zweigbergk <martinvonz@google.com>
parents:
37772
diff
changeset
|
894 ffff |
66dc9db6ed2c
shortest: make {shortest("fffffffff")} work again
Martin von Zweigbergk <martinvonz@google.com>
parents:
37772
diff
changeset
|
895 |
66dc9db6ed2c
shortest: make {shortest("fffffffff")} work again
Martin von Zweigbergk <martinvonz@google.com>
parents:
37772
diff
changeset
|
896 $ hg log --template '{shortest("fffffff")}\n' -l1 |
66dc9db6ed2c
shortest: make {shortest("fffffffff")} work again
Martin von Zweigbergk <martinvonz@google.com>
parents:
37772
diff
changeset
|
897 ffff |
66dc9db6ed2c
shortest: make {shortest("fffffffff")} work again
Martin von Zweigbergk <martinvonz@google.com>
parents:
37772
diff
changeset
|
898 |
66dc9db6ed2c
shortest: make {shortest("fffffffff")} work again
Martin von Zweigbergk <martinvonz@google.com>
parents:
37772
diff
changeset
|
899 $ hg log --template '{shortest("ff")}\n' -l1 |
66dc9db6ed2c
shortest: make {shortest("fffffffff")} work again
Martin von Zweigbergk <martinvonz@google.com>
parents:
37772
diff
changeset
|
900 ffff |
66dc9db6ed2c
shortest: make {shortest("fffffffff")} work again
Martin von Zweigbergk <martinvonz@google.com>
parents:
37772
diff
changeset
|
901 |
30231
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
902 $ cd .. |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
903 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
904 Test shortest(node) with the repo having short hash collision: |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
905 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
906 $ hg init hashcollision |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
907 $ cd hashcollision |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
908 $ cat <<EOF >> .hg/hgrc |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
909 > [experimental] |
34866
1644623ab096
config: use 'experimental.evolution.create-markers'
Boris Feld <boris.feld@octobus.net>
parents:
34715
diff
changeset
|
910 > evolution.createmarkers=True |
30231
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
911 > EOF |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
912 $ echo 0 > a |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
913 $ hg ci -qAm 0 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
914 $ for i in 17 129 248 242 480 580 617 1057 2857 4025; do |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
915 > hg up -q 0 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
916 > echo $i > a |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
917 > hg ci -qm $i |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
918 > done |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
919 $ hg up -q null |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
920 $ hg log -r0: -T '{rev}:{node}\n' |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
921 0:b4e73ffab476aa0ee32ed81ca51e07169844bc6a |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
922 1:11424df6dc1dd4ea255eae2b58eaca7831973bbc |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
923 2:11407b3f1b9c3e76a79c1ec5373924df096f0499 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
924 3:11dd92fe0f39dfdaacdaa5f3997edc533875cfc4 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
925 4:10776689e627b465361ad5c296a20a487e153ca4 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
926 5:a00be79088084cb3aff086ab799f8790e01a976b |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
927 6:a0b0acd79b4498d0052993d35a6a748dd51d13e6 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
928 7:a0457b3450b8e1b778f1163b31a435802987fe5d |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
929 8:c56256a09cd28e5764f32e8e2810d0f01e2e357a |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
930 9:c5623987d205cd6d9d8389bfc40fff9dbb670b48 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
931 10:c562ddd9c94164376c20b86b0b4991636a3bf84f |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
932 $ hg debugobsolete a00be79088084cb3aff086ab799f8790e01a976b |
42893
34a46d48d24e
debugobsolete: also issue the "new obsmarkers" messsage
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42480
diff
changeset
|
933 1 new obsolescence markers |
33542
b11e8c67fb0f
debugobsolete: also report the number of obsoleted changesets
Boris Feld <boris.feld@octobus.net>
parents:
33262
diff
changeset
|
934 obsoleted 1 changesets |
30231
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
935 $ hg debugobsolete c5623987d205cd6d9d8389bfc40fff9dbb670b48 |
42893
34a46d48d24e
debugobsolete: also issue the "new obsmarkers" messsage
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42480
diff
changeset
|
936 1 new obsolescence markers |
33542
b11e8c67fb0f
debugobsolete: also report the number of obsoleted changesets
Boris Feld <boris.feld@octobus.net>
parents:
33262
diff
changeset
|
937 obsoleted 1 changesets |
30231
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
938 $ hg debugobsolete c562ddd9c94164376c20b86b0b4991636a3bf84f |
42893
34a46d48d24e
debugobsolete: also issue the "new obsmarkers" messsage
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42480
diff
changeset
|
939 1 new obsolescence markers |
33542
b11e8c67fb0f
debugobsolete: also report the number of obsoleted changesets
Boris Feld <boris.feld@octobus.net>
parents:
33262
diff
changeset
|
940 obsoleted 1 changesets |
30231
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
941 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
942 nodes starting with '11' (we don't have the revision number '11' though) |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
943 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
944 $ hg log -r 1:3 -T '{rev}:{shortest(node, 0)}\n' |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
945 1:1142 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
946 2:1140 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
947 3:11d |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
948 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
949 '5:a00' is hidden, but still we have two nodes starting with 'a0' |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
950 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
951 $ hg log -r 6:7 -T '{rev}:{shortest(node, 0)}\n' |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
952 6:a0b |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
953 7:a04 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
954 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
955 node '10' conflicts with the revision number '10' even if it is hidden |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
956 (we could exclude hidden revision numbers, but currently we don't) |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
957 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
958 $ hg log -r 4 -T '{rev}:{shortest(node, 0)}\n' |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
959 4:107 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
960 $ hg log -r 4 -T '{rev}:{shortest(node, 0)}\n' --hidden |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
961 4:107 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
962 |
38856
a01200b25da6
shortest: use 'x' prefix to disambiguate from revnum if configured
Martin von Zweigbergk <martinvonz@google.com>
parents:
38449
diff
changeset
|
963 $ hg --config experimental.revisions.prefixhexnode=yes log -r 4 -T '{rev}:{shortest(node, 0)}\n' |
a01200b25da6
shortest: use 'x' prefix to disambiguate from revnum if configured
Martin von Zweigbergk <martinvonz@google.com>
parents:
38449
diff
changeset
|
964 4:x10 |
a01200b25da6
shortest: use 'x' prefix to disambiguate from revnum if configured
Martin von Zweigbergk <martinvonz@google.com>
parents:
38449
diff
changeset
|
965 $ hg --config experimental.revisions.prefixhexnode=yes log -r 4 -T '{rev}:{shortest(node, 0)}\n' --hidden |
a01200b25da6
shortest: use 'x' prefix to disambiguate from revnum if configured
Martin von Zweigbergk <martinvonz@google.com>
parents:
38449
diff
changeset
|
966 4:x10 |
a01200b25da6
shortest: use 'x' prefix to disambiguate from revnum if configured
Martin von Zweigbergk <martinvonz@google.com>
parents:
38449
diff
changeset
|
967 |
30231
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
968 node 'c562' should be unique if the other 'c562' nodes are hidden |
30232
362740e05460
templater: use unfiltered changelog to calculate shortest() at constant time
Yuya Nishihara <yuya@tcha.org>
parents:
30231
diff
changeset
|
969 (but we don't try the slow path to filter out hidden nodes for now) |
30231
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
970 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
971 $ hg log -r 8 -T '{rev}:{node|shortest}\n' |
30232
362740e05460
templater: use unfiltered changelog to calculate shortest() at constant time
Yuya Nishihara <yuya@tcha.org>
parents:
30231
diff
changeset
|
972 8:c5625 |
30231
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
973 $ hg log -r 8:10 -T '{rev}:{node|shortest}\n' --hidden |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
974 8:c5625 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
975 9:c5623 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
976 10:c562d |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
977 |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
978 $ cd .. |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
979 |
40341
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
980 Test prefixhexnode when the first character of the hash is 0. |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
981 $ hg init hashcollision2 |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
982 $ cd hashcollision2 |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
983 $ cat <<EOF >> .hg/hgrc |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
984 > [experimental] |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
985 > evolution.createmarkers=True |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
986 > EOF |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
987 $ echo 0 > a |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
988 $ hg ci -qAm 0 |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
989 $ echo 21 > a |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
990 $ hg ci -qm 21 |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
991 $ hg up -q null |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
992 $ hg log -r0: -T '{rev}:{node}\n' |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
993 0:b4e73ffab476aa0ee32ed81ca51e07169844bc6a |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
994 1:0cf177ba2b1dc3862a00fb81715fec90950201be |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
995 |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
996 we need the 'x' prefix to ensure we aren't colliding with rev0. We identify |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
997 the collision with nullid if we aren't using disambiguatewithin, so we need to set |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
998 that as well. |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
999 $ hg --config experimental.revisions.disambiguatewithin='descendants(0)' \ |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1000 > --config experimental.revisions.prefixhexnode=yes \ |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1001 > log -r 1 -T '{rev}:{shortest(node, 0)}\n' |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1002 1:x0 |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1003 |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1004 $ hg debugobsolete 0cf177ba2b1dc3862a00fb81715fec90950201be |
42893
34a46d48d24e
debugobsolete: also issue the "new obsmarkers" messsage
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42480
diff
changeset
|
1005 1 new obsolescence markers |
40341
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1006 obsoleted 1 changesets |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1007 $ hg up -q 0 |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1008 $ echo 61 > a |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1009 $ hg ci -m 61 |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1010 $ hg log -r0: -T '{rev}:{node}\n' |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1011 0:b4e73ffab476aa0ee32ed81ca51e07169844bc6a |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1012 2:01384dde84b3a511ae0835f35ac40bd806c99bb8 |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1013 |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1014 we still have the 'x' prefix because '0' is still the shortest prefix, since |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1015 rev1's '0c' is hidden. |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1016 $ hg --config experimental.revisions.disambiguatewithin=0:-1-0 \ |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1017 > --config experimental.revisions.prefixhexnode=yes \ |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1018 > log -r 0:-1-0 -T '{rev}:{shortest(node, 0)}\n' |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1019 2:x0 |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1020 |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1021 we don't have the 'x' prefix on 2 because '01' is not a synonym for rev1. |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1022 $ hg --config experimental.revisions.disambiguatewithin=0:-1-0 \ |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1023 > --config experimental.revisions.prefixhexnode=yes \ |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1024 > log -r 0:-1-0 -T '{rev}:{shortest(node, 0)}\n' --hidden |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1025 1:0c |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1026 2:01 |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1027 |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1028 $ cd .. |
d916ed3ca951
revisions: when using prefixhexnode, ensure we prefix "0"
Kyle Lippincott <spectral@google.com>
parents:
40189
diff
changeset
|
1029 |
20370
aa51392da507
template: add pad function for padding output
Durham Goode <durham@fb.com>
parents:
20369
diff
changeset
|
1030 Test pad function |
aa51392da507
template: add pad function for padding output
Durham Goode <durham@fb.com>
parents:
20369
diff
changeset
|
1031 |
30231
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
1032 $ cd r |
741e5d7f282d
templater: do not use index.partialmatch() directly to calculate shortest()
Yuya Nishihara <yuya@tcha.org>
parents:
30115
diff
changeset
|
1033 |
20370
aa51392da507
template: add pad function for padding output
Durham Goode <durham@fb.com>
parents:
20369
diff
changeset
|
1034 $ hg log --template '{pad(rev, 20)} {author|user}\n' |
20670 | 1035 2 test |
1036 1 {node|short} | |
20370
aa51392da507
template: add pad function for padding output
Durham Goode <durham@fb.com>
parents:
20369
diff
changeset
|
1037 0 test |
aa51392da507
template: add pad function for padding output
Durham Goode <durham@fb.com>
parents:
20369
diff
changeset
|
1038 |
aa51392da507
template: add pad function for padding output
Durham Goode <durham@fb.com>
parents:
20369
diff
changeset
|
1039 $ hg log --template '{pad(rev, 20, " ", True)} {author|user}\n' |
20670 | 1040 2 test |
1041 1 {node|short} | |
20370
aa51392da507
template: add pad function for padding output
Durham Goode <durham@fb.com>
parents:
20369
diff
changeset
|
1042 0 test |
aa51392da507
template: add pad function for padding output
Durham Goode <durham@fb.com>
parents:
20369
diff
changeset
|
1043 |
aa51392da507
template: add pad function for padding output
Durham Goode <durham@fb.com>
parents:
20369
diff
changeset
|
1044 $ hg log --template '{pad(rev, 20, "-", False)} {author|user}\n' |
20670 | 1045 2------------------- test |
1046 1------------------- {node|short} | |
20370
aa51392da507
template: add pad function for padding output
Durham Goode <durham@fb.com>
parents:
20369
diff
changeset
|
1047 0------------------- test |
20518
1e43f15a647f
template: add ifcontains template function
Durham Goode <durham@fb.com>
parents:
20370
diff
changeset
|
1048 |
40189
9458dbfa7f33
templatefuncs: add truncate parameter to pad
Mark Thomas <mbthomas@fb.com>
parents:
39707
diff
changeset
|
1049 $ hg log --template '{pad(author, 5, "-", False, True)}\n' |
9458dbfa7f33
templatefuncs: add truncate parameter to pad
Mark Thomas <mbthomas@fb.com>
parents:
39707
diff
changeset
|
1050 test- |
9458dbfa7f33
templatefuncs: add truncate parameter to pad
Mark Thomas <mbthomas@fb.com>
parents:
39707
diff
changeset
|
1051 {node |
9458dbfa7f33
templatefuncs: add truncate parameter to pad
Mark Thomas <mbthomas@fb.com>
parents:
39707
diff
changeset
|
1052 test- |
9458dbfa7f33
templatefuncs: add truncate parameter to pad
Mark Thomas <mbthomas@fb.com>
parents:
39707
diff
changeset
|
1053 $ hg log --template '{pad(author, 5, "-", True, True)}\n' |
9458dbfa7f33
templatefuncs: add truncate parameter to pad
Mark Thomas <mbthomas@fb.com>
parents:
39707
diff
changeset
|
1054 -test |
9458dbfa7f33
templatefuncs: add truncate parameter to pad
Mark Thomas <mbthomas@fb.com>
parents:
39707
diff
changeset
|
1055 hort} |
9458dbfa7f33
templatefuncs: add truncate parameter to pad
Mark Thomas <mbthomas@fb.com>
parents:
39707
diff
changeset
|
1056 -test |
9458dbfa7f33
templatefuncs: add truncate parameter to pad
Mark Thomas <mbthomas@fb.com>
parents:
39707
diff
changeset
|
1057 |
25509
576d6c74784b
templater: make pad function evaluate both string and rawstring templates
Yuya Nishihara <yuya@tcha.org>
parents:
25490
diff
changeset
|
1058 Test template string in pad function |
576d6c74784b
templater: make pad function evaluate both string and rawstring templates
Yuya Nishihara <yuya@tcha.org>
parents:
25490
diff
changeset
|
1059 |
576d6c74784b
templater: make pad function evaluate both string and rawstring templates
Yuya Nishihara <yuya@tcha.org>
parents:
25490
diff
changeset
|
1060 $ hg log -r 0 -T '{pad("\{{rev}}", 10)} {author|user}\n' |
576d6c74784b
templater: make pad function evaluate both string and rawstring templates
Yuya Nishihara <yuya@tcha.org>
parents:
25490
diff
changeset
|
1061 {0} test |
576d6c74784b
templater: make pad function evaluate both string and rawstring templates
Yuya Nishihara <yuya@tcha.org>
parents:
25490
diff
changeset
|
1062 |
576d6c74784b
templater: make pad function evaluate both string and rawstring templates
Yuya Nishihara <yuya@tcha.org>
parents:
25490
diff
changeset
|
1063 $ hg log -r 0 -T '{pad(r"\{rev}", 10)} {author|user}\n' |
25597
fd5bc660c9f0
templater: do not reevaluate rawstring as template (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
25596
diff
changeset
|
1064 \{rev} test |
25509
576d6c74784b
templater: make pad function evaluate both string and rawstring templates
Yuya Nishihara <yuya@tcha.org>
parents:
25490
diff
changeset
|
1065 |
28345
d81437c91a26
templater: fix pad() to evaluate int argument and handle error
Yuya Nishihara <yuya@tcha.org>
parents:
28344
diff
changeset
|
1066 Test width argument passed to pad function |
d81437c91a26
templater: fix pad() to evaluate int argument and handle error
Yuya Nishihara <yuya@tcha.org>
parents:
28344
diff
changeset
|
1067 |
d81437c91a26
templater: fix pad() to evaluate int argument and handle error
Yuya Nishihara <yuya@tcha.org>
parents:
28344
diff
changeset
|
1068 $ hg log -r 0 -T '{pad(rev, "1{"0"}")} {author|user}\n' |
d81437c91a26
templater: fix pad() to evaluate int argument and handle error
Yuya Nishihara <yuya@tcha.org>
parents:
28344
diff
changeset
|
1069 0 test |
d81437c91a26
templater: fix pad() to evaluate int argument and handle error
Yuya Nishihara <yuya@tcha.org>
parents:
28344
diff
changeset
|
1070 $ hg log -r 0 -T '{pad(rev, "not an int")}\n' |
d81437c91a26
templater: fix pad() to evaluate int argument and handle error
Yuya Nishihara <yuya@tcha.org>
parents:
28344
diff
changeset
|
1071 hg: parse error: pad() expects an integer width |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1072 [10] |
28345
d81437c91a26
templater: fix pad() to evaluate int argument and handle error
Yuya Nishihara <yuya@tcha.org>
parents:
28344
diff
changeset
|
1073 |
31519
3725986b151a
templater: reject bad fillchar argument passed to pad()
Yuya Nishihara <yuya@tcha.org>
parents:
31518
diff
changeset
|
1074 Test invalid fillchar passed to pad function |
3725986b151a
templater: reject bad fillchar argument passed to pad()
Yuya Nishihara <yuya@tcha.org>
parents:
31518
diff
changeset
|
1075 |
3725986b151a
templater: reject bad fillchar argument passed to pad()
Yuya Nishihara <yuya@tcha.org>
parents:
31518
diff
changeset
|
1076 $ hg log -r 0 -T '{pad(rev, 10, "")}\n' |
3725986b151a
templater: reject bad fillchar argument passed to pad()
Yuya Nishihara <yuya@tcha.org>
parents:
31518
diff
changeset
|
1077 hg: parse error: pad() expects a single fill character |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1078 [10] |
31519
3725986b151a
templater: reject bad fillchar argument passed to pad()
Yuya Nishihara <yuya@tcha.org>
parents:
31518
diff
changeset
|
1079 $ hg log -r 0 -T '{pad(rev, 10, "--")}\n' |
3725986b151a
templater: reject bad fillchar argument passed to pad()
Yuya Nishihara <yuya@tcha.org>
parents:
31518
diff
changeset
|
1080 hg: parse error: pad() expects a single fill character |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1081 [10] |
31519
3725986b151a
templater: reject bad fillchar argument passed to pad()
Yuya Nishihara <yuya@tcha.org>
parents:
31518
diff
changeset
|
1082 |
29817
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1083 Test boolean argument passed to pad function |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1084 |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1085 no crash |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1086 |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1087 $ hg log -r 0 -T '{pad(rev, 10, "-", "f{"oo"}")}\n' |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1088 ---------0 |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1089 |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1090 string/literal |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1091 |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1092 $ hg log -r 0 -T '{pad(rev, 10, "-", "false")}\n' |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1093 ---------0 |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1094 $ hg log -r 0 -T '{pad(rev, 10, "-", false)}\n' |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1095 0--------- |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1096 $ hg log -r 0 -T '{pad(rev, 10, "-", "")}\n' |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1097 0--------- |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1098 |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1099 unknown keyword is evaluated to '' |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1100 |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1101 $ hg log -r 0 -T '{pad(rev, 10, "-", unknownkeyword)}\n' |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1102 0--------- |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1103 |
29085
df838803c1d4
templater: add separate() template function
Martin von Zweigbergk <martinvonz@google.com>
parents:
29059
diff
changeset
|
1104 Test separate function |
df838803c1d4
templater: add separate() template function
Martin von Zweigbergk <martinvonz@google.com>
parents:
29059
diff
changeset
|
1105 |
df838803c1d4
templater: add separate() template function
Martin von Zweigbergk <martinvonz@google.com>
parents:
29059
diff
changeset
|
1106 $ hg log -r 0 -T '{separate("-", "", "a", "b", "", "", "c", "")}\n' |
df838803c1d4
templater: add separate() template function
Martin von Zweigbergk <martinvonz@google.com>
parents:
29059
diff
changeset
|
1107 a-b-c |
df838803c1d4
templater: add separate() template function
Martin von Zweigbergk <martinvonz@google.com>
parents:
29059
diff
changeset
|
1108 $ hg log -r 0 -T '{separate(" ", "{rev}:{node|short}", author|user, branch)}\n' |
df838803c1d4
templater: add separate() template function
Martin von Zweigbergk <martinvonz@google.com>
parents:
29059
diff
changeset
|
1109 0:f7769ec2ab97 test default |
df838803c1d4
templater: add separate() template function
Martin von Zweigbergk <martinvonz@google.com>
parents:
29059
diff
changeset
|
1110 $ hg log -r 0 --color=always -T '{separate(" ", "a", label(red, "b"), "c", label(red, ""), "d")}\n' |
df838803c1d4
templater: add separate() template function
Martin von Zweigbergk <martinvonz@google.com>
parents:
29059
diff
changeset
|
1111 a \x1b[0;31mb\x1b[0m c d (esc) |
df838803c1d4
templater: add separate() template function
Martin von Zweigbergk <martinvonz@google.com>
parents:
29059
diff
changeset
|
1112 |
29817
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1113 Test boolean expression/literal passed to if function |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1114 |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1115 $ hg log -r 0 -T '{if(rev, "rev 0 is True")}\n' |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1116 rev 0 is True |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1117 $ hg log -r 0 -T '{if(0, "literal 0 is True as well")}\n' |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1118 literal 0 is True as well |
38447
b6294c113794
templater: fix truth testing of integer 0 taken from a list/dict
Yuya Nishihara <yuya@tcha.org>
parents:
38435
diff
changeset
|
1119 $ hg log -r 0 -T '{if(min(revset(r"0")), "0 of hybriditem is also True")}\n' |
b6294c113794
templater: fix truth testing of integer 0 taken from a list/dict
Yuya Nishihara <yuya@tcha.org>
parents:
38435
diff
changeset
|
1120 0 of hybriditem is also True |
29817
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1121 $ hg log -r 0 -T '{if("", "", "empty string is False")}\n' |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1122 empty string is False |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1123 $ hg log -r 0 -T '{if(revset(r"0 - 0"), "", "empty list is False")}\n' |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1124 empty list is False |
38289
f9c426385853
templater: abstract truth testing to fix {if(list_of_empty_strings)}
Yuya Nishihara <yuya@tcha.org>
parents:
38286
diff
changeset
|
1125 $ hg log -r 0 -T '{if(revset(r"0"), "non-empty list is True")}\n' |
f9c426385853
templater: abstract truth testing to fix {if(list_of_empty_strings)}
Yuya Nishihara <yuya@tcha.org>
parents:
38286
diff
changeset
|
1126 non-empty list is True |
f9c426385853
templater: abstract truth testing to fix {if(list_of_empty_strings)}
Yuya Nishihara <yuya@tcha.org>
parents:
38286
diff
changeset
|
1127 $ hg log -r 0 -T '{if(revset(r"0") % "", "list of empty strings is True")}\n' |
f9c426385853
templater: abstract truth testing to fix {if(list_of_empty_strings)}
Yuya Nishihara <yuya@tcha.org>
parents:
38286
diff
changeset
|
1128 list of empty strings is True |
29817
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1129 $ hg log -r 0 -T '{if(true, "true is True")}\n' |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1130 true is True |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1131 $ hg log -r 0 -T '{if(false, "", "false is False")}\n' |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1132 false is False |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1133 $ hg log -r 0 -T '{if("false", "non-empty string is True")}\n' |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1134 non-empty string is True |
cc11079644fc
templater: make pad() evaluate boolean argument (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
29636
diff
changeset
|
1135 |
20518
1e43f15a647f
template: add ifcontains template function
Durham Goode <durham@fb.com>
parents:
20370
diff
changeset
|
1136 Test ifcontains function |
1e43f15a647f
template: add ifcontains template function
Durham Goode <durham@fb.com>
parents:
20370
diff
changeset
|
1137 |
22843
b6531d806de8
templater: fix ifcontains when list is a string (issue4399)
Matt Mackall <mpm@selenic.com>
parents:
22582
diff
changeset
|
1138 $ hg log --template '{rev} {ifcontains(rev, "2 two 0", "is in the string", "is not")}\n' |
b6531d806de8
templater: fix ifcontains when list is a string (issue4399)
Matt Mackall <mpm@selenic.com>
parents:
22582
diff
changeset
|
1139 2 is in the string |
b6531d806de8
templater: fix ifcontains when list is a string (issue4399)
Matt Mackall <mpm@selenic.com>
parents:
22582
diff
changeset
|
1140 1 is not |
b6531d806de8
templater: fix ifcontains when list is a string (issue4399)
Matt Mackall <mpm@selenic.com>
parents:
22582
diff
changeset
|
1141 0 is in the string |
b6531d806de8
templater: fix ifcontains when list is a string (issue4399)
Matt Mackall <mpm@selenic.com>
parents:
22582
diff
changeset
|
1142 |
28332
e91371633127
templater: fix ifcontains() to evaluate items argument eagerly
Yuya Nishihara <yuya@tcha.org>
parents:
28331
diff
changeset
|
1143 $ hg log -T '{rev} {ifcontains(rev, "2 two{" 0"}", "is in the string", "is not")}\n' |
e91371633127
templater: fix ifcontains() to evaluate items argument eagerly
Yuya Nishihara <yuya@tcha.org>
parents:
28331
diff
changeset
|
1144 2 is in the string |
e91371633127
templater: fix ifcontains() to evaluate items argument eagerly
Yuya Nishihara <yuya@tcha.org>
parents:
28331
diff
changeset
|
1145 1 is not |
e91371633127
templater: fix ifcontains() to evaluate items argument eagerly
Yuya Nishihara <yuya@tcha.org>
parents:
28331
diff
changeset
|
1146 0 is in the string |
e91371633127
templater: fix ifcontains() to evaluate items argument eagerly
Yuya Nishihara <yuya@tcha.org>
parents:
28331
diff
changeset
|
1147 |
20518
1e43f15a647f
template: add ifcontains template function
Durham Goode <durham@fb.com>
parents:
20370
diff
changeset
|
1148 $ hg log --template '{rev} {ifcontains("a", file_adds, "added a", "did not add a")}\n' |
20670 | 1149 2 did not add a |
20518
1e43f15a647f
template: add ifcontains template function
Durham Goode <durham@fb.com>
parents:
20370
diff
changeset
|
1150 1 did not add a |
1e43f15a647f
template: add ifcontains template function
Durham Goode <durham@fb.com>
parents:
20370
diff
changeset
|
1151 0 added a |
20519
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20518
diff
changeset
|
1152 |
28270
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1153 $ hg log --debug -T '{rev}{ifcontains(1, parents, " is parent of 1")}\n' |
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1154 2 is parent of 1 |
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1155 1 |
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1156 0 |
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1157 |
38267
fb874fc1d9b4
templater: abstract ifcontains() over wrapped types
Yuya Nishihara <yuya@tcha.org>
parents:
38265
diff
changeset
|
1158 $ hg log -l1 -T '{ifcontains("branch", extras, "t", "f")}\n' |
fb874fc1d9b4
templater: abstract ifcontains() over wrapped types
Yuya Nishihara <yuya@tcha.org>
parents:
38265
diff
changeset
|
1159 t |
fb874fc1d9b4
templater: abstract ifcontains() over wrapped types
Yuya Nishihara <yuya@tcha.org>
parents:
38265
diff
changeset
|
1160 $ hg log -l1 -T '{ifcontains("branch", extras % "{key}", "t", "f")}\n' |
fb874fc1d9b4
templater: abstract ifcontains() over wrapped types
Yuya Nishihara <yuya@tcha.org>
parents:
38265
diff
changeset
|
1161 t |
fb874fc1d9b4
templater: abstract ifcontains() over wrapped types
Yuya Nishihara <yuya@tcha.org>
parents:
38265
diff
changeset
|
1162 $ hg log -l1 -T '{ifcontains("branc", extras % "{key}", "t", "f")}\n' |
fb874fc1d9b4
templater: abstract ifcontains() over wrapped types
Yuya Nishihara <yuya@tcha.org>
parents:
38265
diff
changeset
|
1163 f |
fb874fc1d9b4
templater: abstract ifcontains() over wrapped types
Yuya Nishihara <yuya@tcha.org>
parents:
38265
diff
changeset
|
1164 $ hg log -l1 -T '{ifcontains("branc", stringify(extras % "{key}"), "t", "f")}\n' |
fb874fc1d9b4
templater: abstract ifcontains() over wrapped types
Yuya Nishihara <yuya@tcha.org>
parents:
38265
diff
changeset
|
1165 t |
fb874fc1d9b4
templater: abstract ifcontains() over wrapped types
Yuya Nishihara <yuya@tcha.org>
parents:
38265
diff
changeset
|
1166 |
20519
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20518
diff
changeset
|
1167 Test revset function |
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20518
diff
changeset
|
1168 |
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20518
diff
changeset
|
1169 $ hg log --template '{rev} {ifcontains(rev, revset("."), "current rev", "not current rev")}\n' |
20670 | 1170 2 current rev |
1171 1 not current rev | |
20519
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20518
diff
changeset
|
1172 0 not current rev |
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20518
diff
changeset
|
1173 |
21540
d8fb835376d1
templates: fix ifcontains against sets with length > 1 (issue4259)
Durham Goode <durham@fb.com>
parents:
21024
diff
changeset
|
1174 $ hg log --template '{rev} {ifcontains(rev, revset(". + .^"), "match rev", "not match rev")}\n' |
d8fb835376d1
templates: fix ifcontains against sets with length > 1 (issue4259)
Durham Goode <durham@fb.com>
parents:
21024
diff
changeset
|
1175 2 match rev |
d8fb835376d1
templates: fix ifcontains against sets with length > 1 (issue4259)
Durham Goode <durham@fb.com>
parents:
21024
diff
changeset
|
1176 1 match rev |
d8fb835376d1
templates: fix ifcontains against sets with length > 1 (issue4259)
Durham Goode <durham@fb.com>
parents:
21024
diff
changeset
|
1177 0 not match rev |
d8fb835376d1
templates: fix ifcontains against sets with length > 1 (issue4259)
Durham Goode <durham@fb.com>
parents:
21024
diff
changeset
|
1178 |
34659
3edfd472f3cb
templater: fix ifcontains() to handle type mismatch gracefully
Yuya Nishihara <yuya@tcha.org>
parents:
34581
diff
changeset
|
1179 $ hg log -T '{ifcontains(desc, revset(":"), "", "type not match")}\n' -l1 |
3edfd472f3cb
templater: fix ifcontains() to handle type mismatch gracefully
Yuya Nishihara <yuya@tcha.org>
parents:
34581
diff
changeset
|
1180 type not match |
3edfd472f3cb
templater: fix ifcontains() to handle type mismatch gracefully
Yuya Nishihara <yuya@tcha.org>
parents:
34581
diff
changeset
|
1181 |
20519
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20518
diff
changeset
|
1182 $ hg log --template '{rev} Parents: {revset("parents(%s)", rev)}\n' |
20670 | 1183 2 Parents: 1 |
20519
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20518
diff
changeset
|
1184 1 Parents: 0 |
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20518
diff
changeset
|
1185 0 Parents: |
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20518
diff
changeset
|
1186 |
22304
5678b0e3608f
templater: enable alias predicates to be used in "revset()" function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21944
diff
changeset
|
1187 $ cat >> .hg/hgrc <<EOF |
5678b0e3608f
templater: enable alias predicates to be used in "revset()" function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21944
diff
changeset
|
1188 > [revsetalias] |
5678b0e3608f
templater: enable alias predicates to be used in "revset()" function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21944
diff
changeset
|
1189 > myparents(\$1) = parents(\$1) |
5678b0e3608f
templater: enable alias predicates to be used in "revset()" function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21944
diff
changeset
|
1190 > EOF |
5678b0e3608f
templater: enable alias predicates to be used in "revset()" function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21944
diff
changeset
|
1191 $ hg log --template '{rev} Parents: {revset("myparents(%s)", rev)}\n' |
5678b0e3608f
templater: enable alias predicates to be used in "revset()" function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21944
diff
changeset
|
1192 2 Parents: 1 |
5678b0e3608f
templater: enable alias predicates to be used in "revset()" function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21944
diff
changeset
|
1193 1 Parents: 0 |
5678b0e3608f
templater: enable alias predicates to be used in "revset()" function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21944
diff
changeset
|
1194 0 Parents: |
5678b0e3608f
templater: enable alias predicates to be used in "revset()" function
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21944
diff
changeset
|
1195 |
20519
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20518
diff
changeset
|
1196 $ hg log --template 'Rev: {rev}\n{revset("::%s", rev) % "Ancestor: {revision}\n"}\n' |
20670 | 1197 Rev: 2 |
1198 Ancestor: 0 | |
1199 Ancestor: 1 | |
1200 Ancestor: 2 | |
1201 | |
20519
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20518
diff
changeset
|
1202 Rev: 1 |
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20518
diff
changeset
|
1203 Ancestor: 0 |
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20518
diff
changeset
|
1204 Ancestor: 1 |
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20518
diff
changeset
|
1205 |
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20518
diff
changeset
|
1206 Rev: 0 |
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20518
diff
changeset
|
1207 Ancestor: 0 |
cda9d2b6beab
template: add revset() template function
Durham Goode <durham@fb.com>
parents:
20518
diff
changeset
|
1208 |
25637
5eccebe23942
templater: evaluate "query" argument passed to revset()
Yuya Nishihara <yuya@tcha.org>
parents:
25562
diff
changeset
|
1209 $ hg log --template '{revset("TIP"|lower)}\n' -l1 |
5eccebe23942
templater: evaluate "query" argument passed to revset()
Yuya Nishihara <yuya@tcha.org>
parents:
25562
diff
changeset
|
1210 2 |
5eccebe23942
templater: evaluate "query" argument passed to revset()
Yuya Nishihara <yuya@tcha.org>
parents:
25562
diff
changeset
|
1211 |
28333
41373244f4e5
templater: fix revset() to evaluate format arguments eagerly
Yuya Nishihara <yuya@tcha.org>
parents:
28332
diff
changeset
|
1212 $ hg log -T '{revset("%s", "t{"ip"}")}\n' -l1 |
41373244f4e5
templater: fix revset() to evaluate format arguments eagerly
Yuya Nishihara <yuya@tcha.org>
parents:
28332
diff
changeset
|
1213 2 |
41373244f4e5
templater: fix revset() to evaluate format arguments eagerly
Yuya Nishihara <yuya@tcha.org>
parents:
28332
diff
changeset
|
1214 |
28270
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1215 a list template is evaluated for each item of revset/parents |
26234
e4609ec959f8
templater: switch ctx of list expression to rev of revset() (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
26222
diff
changeset
|
1216 |
e4609ec959f8
templater: switch ctx of list expression to rev of revset() (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
26222
diff
changeset
|
1217 $ hg log -T '{rev} p: {revset("p1(%s)", rev) % "{rev}:{node|short}"}\n' |
e4609ec959f8
templater: switch ctx of list expression to rev of revset() (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
26222
diff
changeset
|
1218 2 p: 1:bcc7ff960b8e |
e4609ec959f8
templater: switch ctx of list expression to rev of revset() (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
26222
diff
changeset
|
1219 1 p: 0:f7769ec2ab97 |
e4609ec959f8
templater: switch ctx of list expression to rev of revset() (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
26222
diff
changeset
|
1220 0 p: |
e4609ec959f8
templater: switch ctx of list expression to rev of revset() (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
26222
diff
changeset
|
1221 |
28270
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1222 $ hg log --debug -T '{rev} p:{parents % " {rev}:{node|short}"}\n' |
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1223 2 p: 1:bcc7ff960b8e -1:000000000000 |
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1224 1 p: 0:f7769ec2ab97 -1:000000000000 |
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1225 0 p: -1:000000000000 -1:000000000000 |
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1226 |
26234
e4609ec959f8
templater: switch ctx of list expression to rev of revset() (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
26222
diff
changeset
|
1227 therefore, 'revcache' should be recreated for each rev |
e4609ec959f8
templater: switch ctx of list expression to rev of revset() (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
26222
diff
changeset
|
1228 |
e4609ec959f8
templater: switch ctx of list expression to rev of revset() (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
26222
diff
changeset
|
1229 $ hg log -T '{rev} {file_adds}\np {revset("p1(%s)", rev) % "{file_adds}"}\n' |
e4609ec959f8
templater: switch ctx of list expression to rev of revset() (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
26222
diff
changeset
|
1230 2 aa b |
e4609ec959f8
templater: switch ctx of list expression to rev of revset() (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
26222
diff
changeset
|
1231 p |
e4609ec959f8
templater: switch ctx of list expression to rev of revset() (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
26222
diff
changeset
|
1232 1 |
e4609ec959f8
templater: switch ctx of list expression to rev of revset() (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
26222
diff
changeset
|
1233 p a |
e4609ec959f8
templater: switch ctx of list expression to rev of revset() (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
26222
diff
changeset
|
1234 0 a |
e4609ec959f8
templater: switch ctx of list expression to rev of revset() (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
26222
diff
changeset
|
1235 p |
e4609ec959f8
templater: switch ctx of list expression to rev of revset() (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
26222
diff
changeset
|
1236 |
28270
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1237 $ hg log --debug -T '{rev} {file_adds}\np {parents % "{file_adds}"}\n' |
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1238 2 aa b |
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1239 p |
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1240 1 |
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1241 p a |
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1242 0 a |
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1243 p |
650c9f69a744
templatekw: switch ctx of list expression to rev of {parents} (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
28239
diff
changeset
|
1244 |
28177
ab8107c923b4
templater: evaluate each item of revset() as integer revision
Yuya Nishihara <yuya@tcha.org>
parents:
27994
diff
changeset
|
1245 a revset item must be evaluated as an integer revision, not an offset from tip |
ab8107c923b4
templater: evaluate each item of revset() as integer revision
Yuya Nishihara <yuya@tcha.org>
parents:
27994
diff
changeset
|
1246 |
ab8107c923b4
templater: evaluate each item of revset() as integer revision
Yuya Nishihara <yuya@tcha.org>
parents:
27994
diff
changeset
|
1247 $ hg log -l 1 -T '{revset("null") % "{rev}:{node|short}"}\n' |
ab8107c923b4
templater: evaluate each item of revset() as integer revision
Yuya Nishihara <yuya@tcha.org>
parents:
27994
diff
changeset
|
1248 -1:000000000000 |
ab8107c923b4
templater: evaluate each item of revset() as integer revision
Yuya Nishihara <yuya@tcha.org>
parents:
27994
diff
changeset
|
1249 $ hg log -l 1 -T '{revset("%s", "null") % "{rev}:{node|short}"}\n' |
ab8107c923b4
templater: evaluate each item of revset() as integer revision
Yuya Nishihara <yuya@tcha.org>
parents:
27994
diff
changeset
|
1250 -1:000000000000 |
ab8107c923b4
templater: evaluate each item of revset() as integer revision
Yuya Nishihara <yuya@tcha.org>
parents:
27994
diff
changeset
|
1251 |
29623
33bf8bd8c5b9
templatekw: fix join format of revset() function
Yuya Nishihara <yuya@tcha.org>
parents:
29085
diff
changeset
|
1252 join() should pick '{rev}' from revset items: |
33bf8bd8c5b9
templatekw: fix join format of revset() function
Yuya Nishihara <yuya@tcha.org>
parents:
29085
diff
changeset
|
1253 |
33bf8bd8c5b9
templatekw: fix join format of revset() function
Yuya Nishihara <yuya@tcha.org>
parents:
29085
diff
changeset
|
1254 $ hg log -R ../a -T '{join(revset("parents(%d)", rev), ", ")}\n' -r6 |
33bf8bd8c5b9
templatekw: fix join format of revset() function
Yuya Nishihara <yuya@tcha.org>
parents:
29085
diff
changeset
|
1255 4, 5 |
33bf8bd8c5b9
templatekw: fix join format of revset() function
Yuya Nishihara <yuya@tcha.org>
parents:
29085
diff
changeset
|
1256 |
29624
1a129dd05b7d
templatekw: fix join format of parents keyword (issue5292)
Yuya Nishihara <yuya@tcha.org>
parents:
29623
diff
changeset
|
1257 on the other hand, parents are formatted as '{rev}:{node|formatnode}' by |
1a129dd05b7d
templatekw: fix join format of parents keyword (issue5292)
Yuya Nishihara <yuya@tcha.org>
parents:
29623
diff
changeset
|
1258 default. join() should agree with the default formatting: |
1a129dd05b7d
templatekw: fix join format of parents keyword (issue5292)
Yuya Nishihara <yuya@tcha.org>
parents:
29623
diff
changeset
|
1259 |
1a129dd05b7d
templatekw: fix join format of parents keyword (issue5292)
Yuya Nishihara <yuya@tcha.org>
parents:
29623
diff
changeset
|
1260 $ hg log -R ../a -T '{join(parents, ", ")}\n' -r6 |
1a129dd05b7d
templatekw: fix join format of parents keyword (issue5292)
Yuya Nishihara <yuya@tcha.org>
parents:
29623
diff
changeset
|
1261 5:13207e5a10d9, 4:bbe44766e73d |
1a129dd05b7d
templatekw: fix join format of parents keyword (issue5292)
Yuya Nishihara <yuya@tcha.org>
parents:
29623
diff
changeset
|
1262 |
1a129dd05b7d
templatekw: fix join format of parents keyword (issue5292)
Yuya Nishihara <yuya@tcha.org>
parents:
29623
diff
changeset
|
1263 $ hg log -R ../a -T '{join(parents, ",\n")}\n' -r6 --debug |
1a129dd05b7d
templatekw: fix join format of parents keyword (issue5292)
Yuya Nishihara <yuya@tcha.org>
parents:
29623
diff
changeset
|
1264 5:13207e5a10d9fd28ec424934298e176197f2c67f, |
1a129dd05b7d
templatekw: fix join format of parents keyword (issue5292)
Yuya Nishihara <yuya@tcha.org>
parents:
29623
diff
changeset
|
1265 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74 |
1a129dd05b7d
templatekw: fix join format of parents keyword (issue5292)
Yuya Nishihara <yuya@tcha.org>
parents:
29623
diff
changeset
|
1266 |
44589
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1267 for historical reasons, revset() supports old-style list template |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1268 |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1269 $ hg log -T '{revset(":")}\n' -l1 \ |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1270 > --config templates.start_revisions='"["' \ |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1271 > --config templates.end_revisions='"]"' \ |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1272 > --config templates.revision='"{revision}, "' \ |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1273 > --config templates.last_revision='"{revision}"' |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1274 [0, 1, 2] |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1275 $ hg log -T '{revset(":") % " {revision}"}\n' -l1 |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1276 0 1 2 |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1277 |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1278 but a filtered one doesn't |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1279 |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1280 $ hg log -T '{filter(revset(":"), ifeq(rev, 1, "", "y"))}\n' -l1 \ |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1281 > --config templates.start_revisions='"["' \ |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1282 > --config templates.end_revisions='"]"' \ |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1283 > --config templates.revision='"{revision}, "' \ |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1284 > --config templates.last_revision='"{revision}"' |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1285 0 2 |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1286 $ hg log -T '{filter(revset(":"), ifeq(rev, 1, "", "y")) % "x{revision}"}\n' -l1 |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1287 xx |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1288 |
44582
482a6aac1f15
revset: allow repo.revs('%d', wdirrev)
Yuya Nishihara <yuya@tcha.org>
parents:
43695
diff
changeset
|
1289 %d parameter handling: |
482a6aac1f15
revset: allow repo.revs('%d', wdirrev)
Yuya Nishihara <yuya@tcha.org>
parents:
43695
diff
changeset
|
1290 |
482a6aac1f15
revset: allow repo.revs('%d', wdirrev)
Yuya Nishihara <yuya@tcha.org>
parents:
43695
diff
changeset
|
1291 $ hg log -T '{revset("%d", rev)}\n' -r'wdir()' |
482a6aac1f15
revset: allow repo.revs('%d', wdirrev)
Yuya Nishihara <yuya@tcha.org>
parents:
43695
diff
changeset
|
1292 2147483647 |
482a6aac1f15
revset: allow repo.revs('%d', wdirrev)
Yuya Nishihara <yuya@tcha.org>
parents:
43695
diff
changeset
|
1293 $ hg log -T '{revset("%d", rev)}\n' -r'null' |
482a6aac1f15
revset: allow repo.revs('%d', wdirrev)
Yuya Nishihara <yuya@tcha.org>
parents:
43695
diff
changeset
|
1294 -1 |
44583
967e2e81f762
revset: fix crash by repo.revs('%d', tip + 1)
Yuya Nishihara <yuya@tcha.org>
parents:
44582
diff
changeset
|
1295 $ hg log -T '{revset("%d", rev + 1)}\n' -r'tip' |
45906
95c4cca641f6
errors: remove trailing "!" from some error messages for consistency
Martin von Zweigbergk <martinvonz@google.com>
parents:
45895
diff
changeset
|
1296 abort: unknown revision '3' |
48368
8c4881c07f57
errors: use detailed exit code for RepoLookupError
Martin von Zweigbergk <martinvonz@google.com>
parents:
45906
diff
changeset
|
1297 [10] |
44583
967e2e81f762
revset: fix crash by repo.revs('%d', tip + 1)
Yuya Nishihara <yuya@tcha.org>
parents:
44582
diff
changeset
|
1298 $ hg log -T '{revset("%d", rev - 1)}\n' -r'null' |
45906
95c4cca641f6
errors: remove trailing "!" from some error messages for consistency
Martin von Zweigbergk <martinvonz@google.com>
parents:
45895
diff
changeset
|
1299 abort: unknown revision '-2' |
48368
8c4881c07f57
errors: use detailed exit code for RepoLookupError
Martin von Zweigbergk <martinvonz@google.com>
parents:
45906
diff
changeset
|
1300 [10] |
44582
482a6aac1f15
revset: allow repo.revs('%d', wdirrev)
Yuya Nishihara <yuya@tcha.org>
parents:
43695
diff
changeset
|
1301 |
35561
4c3a4bb31c0e
revsetlang: raise ParseError to report invalid format character
Yuya Nishihara <yuya@tcha.org>
parents:
35470
diff
changeset
|
1302 Invalid arguments passed to revset() |
4c3a4bb31c0e
revsetlang: raise ParseError to report invalid format character
Yuya Nishihara <yuya@tcha.org>
parents:
35470
diff
changeset
|
1303 |
4c3a4bb31c0e
revsetlang: raise ParseError to report invalid format character
Yuya Nishihara <yuya@tcha.org>
parents:
35470
diff
changeset
|
1304 $ hg log -T '{revset("%whatever", 0)}\n' |
4c3a4bb31c0e
revsetlang: raise ParseError to report invalid format character
Yuya Nishihara <yuya@tcha.org>
parents:
35470
diff
changeset
|
1305 hg: parse error: unexpected revspec format character w |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1306 [10] |
35591
8f1a7adb3225
revsetlang: catch invalid format character with %l prefix
Yuya Nishihara <yuya@tcha.org>
parents:
35561
diff
changeset
|
1307 $ hg log -T '{revset("%lwhatever", files)}\n' |
8f1a7adb3225
revsetlang: catch invalid format character with %l prefix
Yuya Nishihara <yuya@tcha.org>
parents:
35561
diff
changeset
|
1308 hg: parse error: unexpected revspec format character w |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1309 [10] |
35592
0fd617afebc0
revsetlang: check number of arguments passed to formatspec()
Yuya Nishihara <yuya@tcha.org>
parents:
35591
diff
changeset
|
1310 $ hg log -T '{revset("%s %s", 0)}\n' |
0fd617afebc0
revsetlang: check number of arguments passed to formatspec()
Yuya Nishihara <yuya@tcha.org>
parents:
35591
diff
changeset
|
1311 hg: parse error: missing argument for revspec |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1312 [10] |
35592
0fd617afebc0
revsetlang: check number of arguments passed to formatspec()
Yuya Nishihara <yuya@tcha.org>
parents:
35591
diff
changeset
|
1313 $ hg log -T '{revset("", 0)}\n' |
0fd617afebc0
revsetlang: check number of arguments passed to formatspec()
Yuya Nishihara <yuya@tcha.org>
parents:
35591
diff
changeset
|
1314 hg: parse error: too many revspec arguments specified |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1315 [10] |
35592
0fd617afebc0
revsetlang: check number of arguments passed to formatspec()
Yuya Nishihara <yuya@tcha.org>
parents:
35591
diff
changeset
|
1316 $ hg log -T '{revset("%s", 0, 1)}\n' |
0fd617afebc0
revsetlang: check number of arguments passed to formatspec()
Yuya Nishihara <yuya@tcha.org>
parents:
35591
diff
changeset
|
1317 hg: parse error: too many revspec arguments specified |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1318 [10] |
35593
850cd045b1df
revsetlang: check incomplete revspec format character
Yuya Nishihara <yuya@tcha.org>
parents:
35592
diff
changeset
|
1319 $ hg log -T '{revset("%", 0)}\n' |
850cd045b1df
revsetlang: check incomplete revspec format character
Yuya Nishihara <yuya@tcha.org>
parents:
35592
diff
changeset
|
1320 hg: parse error: incomplete revspec format character |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1321 [10] |
35593
850cd045b1df
revsetlang: check incomplete revspec format character
Yuya Nishihara <yuya@tcha.org>
parents:
35592
diff
changeset
|
1322 $ hg log -T '{revset("%l", 0)}\n' |
850cd045b1df
revsetlang: check incomplete revspec format character
Yuya Nishihara <yuya@tcha.org>
parents:
35592
diff
changeset
|
1323 hg: parse error: incomplete revspec format character |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1324 [10] |
35594
468d7a1f6633
revsetlang: catch invalid value passed to formatspec()
Yuya Nishihara <yuya@tcha.org>
parents:
35593
diff
changeset
|
1325 $ hg log -T '{revset("%d", 'foo')}\n' |
468d7a1f6633
revsetlang: catch invalid value passed to formatspec()
Yuya Nishihara <yuya@tcha.org>
parents:
35593
diff
changeset
|
1326 hg: parse error: invalid argument for revspec |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1327 [10] |
35594
468d7a1f6633
revsetlang: catch invalid value passed to formatspec()
Yuya Nishihara <yuya@tcha.org>
parents:
35593
diff
changeset
|
1328 $ hg log -T '{revset("%ld", files)}\n' |
468d7a1f6633
revsetlang: catch invalid value passed to formatspec()
Yuya Nishihara <yuya@tcha.org>
parents:
35593
diff
changeset
|
1329 hg: parse error: invalid argument for revspec |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1330 [10] |
35594
468d7a1f6633
revsetlang: catch invalid value passed to formatspec()
Yuya Nishihara <yuya@tcha.org>
parents:
35593
diff
changeset
|
1331 $ hg log -T '{revset("%ls", 0)}\n' |
468d7a1f6633
revsetlang: catch invalid value passed to formatspec()
Yuya Nishihara <yuya@tcha.org>
parents:
35593
diff
changeset
|
1332 hg: parse error: invalid argument for revspec |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1333 [10] |
35594
468d7a1f6633
revsetlang: catch invalid value passed to formatspec()
Yuya Nishihara <yuya@tcha.org>
parents:
35593
diff
changeset
|
1334 $ hg log -T '{revset("%b", 'foo')}\n' |
468d7a1f6633
revsetlang: catch invalid value passed to formatspec()
Yuya Nishihara <yuya@tcha.org>
parents:
35593
diff
changeset
|
1335 hg: parse error: invalid argument for revspec |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1336 [10] |
35594
468d7a1f6633
revsetlang: catch invalid value passed to formatspec()
Yuya Nishihara <yuya@tcha.org>
parents:
35593
diff
changeset
|
1337 $ hg log -T '{revset("%lb", files)}\n' |
468d7a1f6633
revsetlang: catch invalid value passed to formatspec()
Yuya Nishihara <yuya@tcha.org>
parents:
35593
diff
changeset
|
1338 hg: parse error: invalid argument for revspec |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1339 [10] |
35594
468d7a1f6633
revsetlang: catch invalid value passed to formatspec()
Yuya Nishihara <yuya@tcha.org>
parents:
35593
diff
changeset
|
1340 $ hg log -T '{revset("%r", 0)}\n' |
468d7a1f6633
revsetlang: catch invalid value passed to formatspec()
Yuya Nishihara <yuya@tcha.org>
parents:
35593
diff
changeset
|
1341 hg: parse error: invalid argument for revspec |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1342 [10] |
35561
4c3a4bb31c0e
revsetlang: raise ParseError to report invalid format character
Yuya Nishihara <yuya@tcha.org>
parents:
35470
diff
changeset
|
1343 |
44589
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1344 Invalid operation on revset() |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1345 |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1346 $ hg log -T '{get(revset(":"), "foo")}\n' |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1347 hg: parse error: not a dictionary |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1348 (get() expects a dict as first argument) |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1349 [10] |
44589
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1350 |
30008
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1351 Test files function |
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1352 |
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1353 $ hg log -T "{rev}\n{join(files('*'), '\n')}\n" |
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1354 2 |
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1355 a |
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1356 aa |
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1357 b |
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1358 1 |
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1359 a |
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1360 0 |
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1361 a |
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1362 |
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1363 $ hg log -T "{rev}\n{join(files('aa'), '\n')}\n" |
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1364 2 |
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1365 aa |
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1366 1 |
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1367 |
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1368 0 |
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1369 |
39367
83f8f7b9fa60
templatekw: alias {file} of files list to {path}
Yuya Nishihara <yuya@tcha.org>
parents:
38856
diff
changeset
|
1370 |
83f8f7b9fa60
templatekw: alias {file} of files list to {path}
Yuya Nishihara <yuya@tcha.org>
parents:
38856
diff
changeset
|
1371 $ hg log -l1 -T "{files('aa') % '{file}\n'}" |
83f8f7b9fa60
templatekw: alias {file} of files list to {path}
Yuya Nishihara <yuya@tcha.org>
parents:
38856
diff
changeset
|
1372 aa |
83f8f7b9fa60
templatekw: alias {file} of files list to {path}
Yuya Nishihara <yuya@tcha.org>
parents:
38856
diff
changeset
|
1373 $ hg log -l1 -T "{files('aa') % '{path}\n'}" |
83f8f7b9fa60
templatekw: alias {file} of files list to {path}
Yuya Nishihara <yuya@tcha.org>
parents:
38856
diff
changeset
|
1374 aa |
83f8f7b9fa60
templatekw: alias {file} of files list to {path}
Yuya Nishihara <yuya@tcha.org>
parents:
38856
diff
changeset
|
1375 |
38277
aaed058a0390
context: make workingctx.matches() filter our removed files (API)
Martin von Zweigbergk <martinvonz@google.com>
parents:
38271
diff
changeset
|
1376 $ hg rm a |
aaed058a0390
context: make workingctx.matches() filter our removed files (API)
Martin von Zweigbergk <martinvonz@google.com>
parents:
38271
diff
changeset
|
1377 $ hg log -r "wdir()" -T "{rev}\n{join(files('*'), '\n')}\n" |
aaed058a0390
context: make workingctx.matches() filter our removed files (API)
Martin von Zweigbergk <martinvonz@google.com>
parents:
38271
diff
changeset
|
1378 2147483647 |
aaed058a0390
context: make workingctx.matches() filter our removed files (API)
Martin von Zweigbergk <martinvonz@google.com>
parents:
38271
diff
changeset
|
1379 aa |
aaed058a0390
context: make workingctx.matches() filter our removed files (API)
Martin von Zweigbergk <martinvonz@google.com>
parents:
38271
diff
changeset
|
1380 b |
aaed058a0390
context: make workingctx.matches() filter our removed files (API)
Martin von Zweigbergk <martinvonz@google.com>
parents:
38271
diff
changeset
|
1381 $ hg revert a |
30008
e83f89d3b1f7
templates: add built-in files() function
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
parents:
29848
diff
changeset
|
1382 |
30083
bd1f043d1ea3
templater: add relpath() to convert repo path to relative path (issue5394)
Yuya Nishihara <yuya@tcha.org>
parents:
30008
diff
changeset
|
1383 Test relpath function |
bd1f043d1ea3
templater: add relpath() to convert repo path to relative path (issue5394)
Yuya Nishihara <yuya@tcha.org>
parents:
30008
diff
changeset
|
1384 |
bd1f043d1ea3
templater: add relpath() to convert repo path to relative path (issue5394)
Yuya Nishihara <yuya@tcha.org>
parents:
30008
diff
changeset
|
1385 $ hg log -r0 -T '{files % "{file|relpath}\n"}' |
bd1f043d1ea3
templater: add relpath() to convert repo path to relative path (issue5394)
Yuya Nishihara <yuya@tcha.org>
parents:
30008
diff
changeset
|
1386 a |
bd1f043d1ea3
templater: add relpath() to convert repo path to relative path (issue5394)
Yuya Nishihara <yuya@tcha.org>
parents:
30008
diff
changeset
|
1387 $ cd .. |
bd1f043d1ea3
templater: add relpath() to convert repo path to relative path (issue5394)
Yuya Nishihara <yuya@tcha.org>
parents:
30008
diff
changeset
|
1388 $ hg log -R r -r0 -T '{files % "{file|relpath}\n"}' |
30732
d4ec69ff652a
tests: update globs for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
30237
diff
changeset
|
1389 r/a |
27894
a94f7eef3199
templatekw: add {namespaces} keyword
Yuya Nishihara <yuya@tcha.org>
parents:
26856
diff
changeset
|
1390 |
20662
a54c0d830499
templater: apply "stringify()" on sub expression to get string correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20661
diff
changeset
|
1391 Test stringify on sub expressions |
a54c0d830499
templater: apply "stringify()" on sub expression to get string correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20661
diff
changeset
|
1392 |
a54c0d830499
templater: apply "stringify()" on sub expression to get string correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20661
diff
changeset
|
1393 $ hg log -R a -r 8 --template '{join(files, if("1", if("1", ", ")))}\n' |
a54c0d830499
templater: apply "stringify()" on sub expression to get string correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20661
diff
changeset
|
1394 fourth, second, third |
a54c0d830499
templater: apply "stringify()" on sub expression to get string correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20661
diff
changeset
|
1395 $ hg log -R a -r 8 --template '{strip(if("1", if("1", "-abc-")), if("1", if("1", "-")))}\n' |
a54c0d830499
templater: apply "stringify()" on sub expression to get string correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20661
diff
changeset
|
1396 abc |
20670 | 1397 |
21820
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1398 Test splitlines |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1399 |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1400 $ hg log -Gv -R a --template "{splitlines(desc) % 'foo {line}\n'}" |
24985
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
1401 @ foo 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
|
1402 | |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
1403 o foo future |
21820
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1404 | |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1405 o foo third |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1406 | |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1407 o foo second |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1408 |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1409 o foo merge |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1410 |\ |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1411 | o foo new head |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1412 | | |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1413 o | foo new branch |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1414 |/ |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1415 o foo no user, no domain |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1416 | |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1417 o foo no person |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1418 | |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1419 o foo other 1 |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1420 | foo other 2 |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1421 | foo |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1422 | foo other 3 |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1423 o foo line 1 |
cce404b0c918
templatefilter: add splitlines function
Ryan McElroy <rmcelroy@fb.com>
parents:
21540
diff
changeset
|
1424 foo line 2 |
21821
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1425 |
32039
2ab7578e685b
templatefilters: fix crash by string formatting of '{x|splitlines}'
Yuya Nishihara <yuya@tcha.org>
parents:
31928
diff
changeset
|
1426 $ hg log -R a -r0 -T '{desc|splitlines}\n' |
2ab7578e685b
templatefilters: fix crash by string formatting of '{x|splitlines}'
Yuya Nishihara <yuya@tcha.org>
parents:
31928
diff
changeset
|
1427 line 1 line 2 |
2ab7578e685b
templatefilters: fix crash by string formatting of '{x|splitlines}'
Yuya Nishihara <yuya@tcha.org>
parents:
31928
diff
changeset
|
1428 $ hg log -R a -r0 -T '{join(desc|splitlines, "|")}\n' |
2ab7578e685b
templatefilters: fix crash by string formatting of '{x|splitlines}'
Yuya Nishihara <yuya@tcha.org>
parents:
31928
diff
changeset
|
1429 line 1|line 2 |
2ab7578e685b
templatefilters: fix crash by string formatting of '{x|splitlines}'
Yuya Nishihara <yuya@tcha.org>
parents:
31928
diff
changeset
|
1430 |
21821
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1431 Test startswith |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1432 $ hg log -Gv -R a --template "{startswith(desc)}" |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1433 hg: parse error: startswith expects two arguments |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1434 [10] |
21821
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1435 |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1436 $ hg log -Gv -R a --template "{startswith('line', desc)}" |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1437 @ |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1438 | |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1439 o |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1440 | |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1441 o |
24985
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
1442 | |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
1443 o |
21821
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1444 |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1445 o |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1446 |\ |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1447 | o |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1448 | | |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1449 o | |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1450 |/ |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1451 o |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1452 | |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1453 o |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1454 | |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1455 o |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1456 | |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1457 o line 1 |
4a445dc5abff
templater: introduce startswith function
Ryan McElroy <rmcelroy@fb.com>
parents:
21820
diff
changeset
|
1458 line 2 |
21822
028a48105191
templater: add symbol to error
Ryan McElroy <rmcelroy@fb.com>
parents:
21821
diff
changeset
|
1459 |
21846
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1460 Test word function (including index out of bounds graceful failure) |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1461 |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1462 $ hg log -Gv -R a --template "{word('1', desc)}" |
24985
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
1463 @ add, |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
1464 | |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
1465 o |
21846
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1466 | |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1467 o |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1468 | |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1469 o |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1470 |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1471 o |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1472 |\ |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1473 | o head |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1474 | | |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1475 o | branch |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1476 |/ |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1477 o user, |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1478 | |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1479 o person |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1480 | |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1481 o 1 |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1482 | |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1483 o 1 |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1484 |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1485 |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1486 Test word third parameter used as splitter |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1487 |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1488 $ hg log -Gv -R a --template "{word('0', desc, 'o')}" |
24985
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
1489 @ M |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
1490 | |
20bff5d09018
tests: add a new commit to test-commandline-template
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
24966
diff
changeset
|
1491 o future |
21846
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1492 | |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1493 o third |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1494 | |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1495 o sec |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1496 |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1497 o merge |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1498 |\ |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1499 | o new head |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1500 | | |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1501 o | new branch |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1502 |/ |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1503 o n |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1504 | |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1505 o n |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1506 | |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1507 o |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1508 | |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1509 o line 1 |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1510 line 2 |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1511 |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1512 Test word error messages for not enough and too many arguments |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1513 |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1514 $ hg log -Gv -R a --template "{word('0')}" |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1515 hg: parse error: word expects two or three arguments, got 1 |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1516 [10] |
21846
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1517 |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1518 $ hg log -Gv -R a --template "{word('0', desc, 'o', 'h', 'b', 'o', 'y')}" |
8f23f8096606
templater: introduce word function
Ryan McElroy <rmcelroy@fb.com>
parents:
21822
diff
changeset
|
1519 hg: parse error: word expects two or three arguments, got 7 |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1520 [10] |
24886
10a13da8840d
templater: fail more gracefully for blank strings to word
Ryan McElroy <rmcelroy@fb.com>
parents:
24853
diff
changeset
|
1521 |
25002
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
1522 Test word for integer literal |
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
1523 |
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
1524 $ hg log -R a --template "{word(2, desc)}\n" -r0 |
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
1525 line |
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
1526 |
24886
10a13da8840d
templater: fail more gracefully for blank strings to word
Ryan McElroy <rmcelroy@fb.com>
parents:
24853
diff
changeset
|
1527 Test word for invalid numbers |
10a13da8840d
templater: fail more gracefully for blank strings to word
Ryan McElroy <rmcelroy@fb.com>
parents:
24853
diff
changeset
|
1528 |
25002
829faf8ab605
templater: tokenize decimal integer literal (issue4638) (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
24985
diff
changeset
|
1529 $ hg log -Gv -R a --template "{word('a', desc)}" |
25003
5e584edbb211
templater: update error message of invalid number passed to word() function
Yuya Nishihara <yuya@tcha.org>
parents:
25002
diff
changeset
|
1530 hg: parse error: word expects an integer index |
45895
fc4fb2f17dd4
errors: use exit code 10 for parse errors
Martin von Zweigbergk <martinvonz@google.com>
parents:
45055
diff
changeset
|
1531 [10] |
25489
ef8956aa8755
templater: introduce indent function
Ryan McElroy <rmcelroy@fb.com>
parents:
25349
diff
changeset
|
1532 |
26502
4ca98a389152
templater: protect word() from crashing on out of range negative value
Matt Harbison <matt_harbison@yahoo.com>
parents:
25862
diff
changeset
|
1533 Test word for out of range |
4ca98a389152
templater: protect word() from crashing on out of range negative value
Matt Harbison <matt_harbison@yahoo.com>
parents:
25862
diff
changeset
|
1534 |
4ca98a389152
templater: protect word() from crashing on out of range negative value
Matt Harbison <matt_harbison@yahoo.com>
parents:
25862
diff
changeset
|
1535 $ hg log -R a --template "{word(10000, desc)}" |
4ca98a389152
templater: protect word() from crashing on out of range negative value
Matt Harbison <matt_harbison@yahoo.com>
parents:
25862
diff
changeset
|
1536 $ hg log -R a --template "{word(-10000, desc)}" |
4ca98a389152
templater: protect word() from crashing on out of range negative value
Matt Harbison <matt_harbison@yahoo.com>
parents:
25862
diff
changeset
|
1537 |
25489
ef8956aa8755
templater: introduce indent function
Ryan McElroy <rmcelroy@fb.com>
parents:
25349
diff
changeset
|
1538 Test indent and not adding to empty lines |
ef8956aa8755
templater: introduce indent function
Ryan McElroy <rmcelroy@fb.com>
parents:
25349
diff
changeset
|
1539 |
ef8956aa8755
templater: introduce indent function
Ryan McElroy <rmcelroy@fb.com>
parents:
25349
diff
changeset
|
1540 $ hg log -T "-----\n{indent(desc, '>> ', ' > ')}\n" -r 0:1 -R a |
ef8956aa8755
templater: introduce indent function
Ryan McElroy <rmcelroy@fb.com>
parents:
25349
diff
changeset
|
1541 ----- |
ef8956aa8755
templater: introduce indent function
Ryan McElroy <rmcelroy@fb.com>
parents:
25349
diff
changeset
|
1542 > line 1 |
ef8956aa8755
templater: introduce indent function
Ryan McElroy <rmcelroy@fb.com>
parents:
25349
diff
changeset
|
1543 >> line 2 |
ef8956aa8755
templater: introduce indent function
Ryan McElroy <rmcelroy@fb.com>
parents:
25349
diff
changeset
|
1544 ----- |
ef8956aa8755
templater: introduce indent function
Ryan McElroy <rmcelroy@fb.com>
parents:
25349
diff
changeset
|
1545 > other 1 |
ef8956aa8755
templater: introduce indent function
Ryan McElroy <rmcelroy@fb.com>
parents:
25349
diff
changeset
|
1546 >> other 2 |
ef8956aa8755
templater: introduce indent function
Ryan McElroy <rmcelroy@fb.com>
parents:
25349
diff
changeset
|
1547 |
ef8956aa8755
templater: introduce indent function
Ryan McElroy <rmcelroy@fb.com>
parents:
25349
diff
changeset
|
1548 >> other 3 |
ef8956aa8755
templater: introduce indent function
Ryan McElroy <rmcelroy@fb.com>
parents:
25349
diff
changeset
|
1549 |
43694
0fd9e7a1cf36
tests: document behavior of indent() with empty first line
Martin von Zweigbergk <martinvonz@google.com>
parents:
43051
diff
changeset
|
1550 Test indent with empty first line |
0fd9e7a1cf36
tests: document behavior of indent() with empty first line
Martin von Zweigbergk <martinvonz@google.com>
parents:
43051
diff
changeset
|
1551 |
0fd9e7a1cf36
tests: document behavior of indent() with empty first line
Martin von Zweigbergk <martinvonz@google.com>
parents:
43051
diff
changeset
|
1552 $ hg version -T "{indent('', '>> ')}\n" |
43695
fa246ada356b
templates: make {indent("", " ")} be empty
Martin von Zweigbergk <martinvonz@google.com>
parents:
43694
diff
changeset
|
1553 |
43694
0fd9e7a1cf36
tests: document behavior of indent() with empty first line
Martin von Zweigbergk <martinvonz@google.com>
parents:
43051
diff
changeset
|
1554 |
0fd9e7a1cf36
tests: document behavior of indent() with empty first line
Martin von Zweigbergk <martinvonz@google.com>
parents:
43051
diff
changeset
|
1555 $ hg version -T "{indent(' |
0fd9e7a1cf36
tests: document behavior of indent() with empty first line
Martin von Zweigbergk <martinvonz@google.com>
parents:
43051
diff
changeset
|
1556 > second', '>> ')}\n" |
43695
fa246ada356b
templates: make {indent("", " ")} be empty
Martin von Zweigbergk <martinvonz@google.com>
parents:
43694
diff
changeset
|
1557 |
43694
0fd9e7a1cf36
tests: document behavior of indent() with empty first line
Martin von Zweigbergk <martinvonz@google.com>
parents:
43051
diff
changeset
|
1558 >> second |
0fd9e7a1cf36
tests: document behavior of indent() with empty first line
Martin von Zweigbergk <martinvonz@google.com>
parents:
43051
diff
changeset
|
1559 |
0fd9e7a1cf36
tests: document behavior of indent() with empty first line
Martin von Zweigbergk <martinvonz@google.com>
parents:
43051
diff
changeset
|
1560 $ hg version -T "{indent(' |
0fd9e7a1cf36
tests: document behavior of indent() with empty first line
Martin von Zweigbergk <martinvonz@google.com>
parents:
43051
diff
changeset
|
1561 > second', '>> ', ' > ')}\n" |
43695
fa246ada356b
templates: make {indent("", " ")} be empty
Martin von Zweigbergk <martinvonz@google.com>
parents:
43694
diff
changeset
|
1562 |
43694
0fd9e7a1cf36
tests: document behavior of indent() with empty first line
Martin von Zweigbergk <martinvonz@google.com>
parents:
43051
diff
changeset
|
1563 >> second |
0fd9e7a1cf36
tests: document behavior of indent() with empty first line
Martin von Zweigbergk <martinvonz@google.com>
parents:
43051
diff
changeset
|
1564 |
25489
ef8956aa8755
templater: introduce indent function
Ryan McElroy <rmcelroy@fb.com>
parents:
25349
diff
changeset
|
1565 Test with non-strings like dates |
ef8956aa8755
templater: introduce indent function
Ryan McElroy <rmcelroy@fb.com>
parents:
25349
diff
changeset
|
1566 |
ef8956aa8755
templater: introduce indent function
Ryan McElroy <rmcelroy@fb.com>
parents:
25349
diff
changeset
|
1567 $ hg log -T "{indent(date, ' ')}\n" -r 2:3 -R a |
38299
88e7105b5cd9
templater: restore the original string format of {date}
Yuya Nishihara <yuya@tcha.org>
parents:
38289
diff
changeset
|
1568 1200000.00 |
88e7105b5cd9
templater: restore the original string format of {date}
Yuya Nishihara <yuya@tcha.org>
parents:
38289
diff
changeset
|
1569 1300000.00 |
26215
72aad184f061
templater: create string unescape helper (issue4798)
Matt Mackall <mpm@selenic.com>
parents:
26188
diff
changeset
|
1570 |
41997
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1571 Test cbor filter: |
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1572 |
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1573 $ cat <<'EOF' > "$TESTTMP/decodecbor.py" |
42000
a66965406528
test-template: fix stdio mode on Windows
Yuya Nishihara <yuya@tcha.org>
parents:
41997
diff
changeset
|
1574 > from mercurial import ( |
a66965406528
test-template: fix stdio mode on Windows
Yuya Nishihara <yuya@tcha.org>
parents:
41997
diff
changeset
|
1575 > dispatch, |
a66965406528
test-template: fix stdio mode on Windows
Yuya Nishihara <yuya@tcha.org>
parents:
41997
diff
changeset
|
1576 > ) |
41997
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1577 > from mercurial.utils import ( |
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1578 > cborutil, |
45055
4c1b4805db57
pycompat: change users of pycompat.{stdin,stdout,stderr} to use procutil.std*
Manuel Jacob <me@manueljacob.de>
parents:
44596
diff
changeset
|
1579 > procutil, |
41997
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1580 > stringutil, |
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1581 > ) |
42000
a66965406528
test-template: fix stdio mode on Windows
Yuya Nishihara <yuya@tcha.org>
parents:
41997
diff
changeset
|
1582 > dispatch.initstdio() |
45055
4c1b4805db57
pycompat: change users of pycompat.{stdin,stdout,stderr} to use procutil.std*
Manuel Jacob <me@manueljacob.de>
parents:
44596
diff
changeset
|
1583 > items = cborutil.decodeall(procutil.stdin.read()) |
4c1b4805db57
pycompat: change users of pycompat.{stdin,stdout,stderr} to use procutil.std*
Manuel Jacob <me@manueljacob.de>
parents:
44596
diff
changeset
|
1584 > procutil.stdout.write(stringutil.pprint(items, indent=1) + b'\n') |
41997
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1585 > EOF |
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1586 |
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1587 $ hg log -T "{rev|cbor}" -R a -l2 | "$PYTHON" "$TESTTMP/decodecbor.py" |
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1588 [ |
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1589 10, |
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1590 9 |
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1591 ] |
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1592 |
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1593 $ hg log -T "{extras|cbor}" -R a -l1 | "$PYTHON" "$TESTTMP/decodecbor.py" |
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1594 [ |
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1595 { |
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1596 'branch': 'default' |
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1597 } |
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1598 ] |
4df7c4b70e03
templatefilters: add {x|cbor} filter for custom CBOR output
Yuya Nishihara <yuya@tcha.org>
parents:
41720
diff
changeset
|
1599 |
44589
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1600 $ hg log -T "{revset(':')|cbor}" -R a -l1 | "$PYTHON" "$TESTTMP/decodecbor.py" |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1601 [ |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1602 [ |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1603 0, |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1604 1, |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1605 2, |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1606 3, |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1607 4, |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1608 5, |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1609 6, |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1610 7, |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1611 8, |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1612 9, |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1613 10 |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1614 ] |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1615 ] |
fc1fa3a07af6
templater: introduce wrapper for smartset (API)
Yuya Nishihara <yuya@tcha.org>
parents:
44583
diff
changeset
|
1616 |
44596
7333e8bb9781
templater: fix cbor() filter to recursively convert smartset to list
Yuya Nishihara <yuya@tcha.org>
parents:
44589
diff
changeset
|
1617 $ hg log -T "{dict(foo=revset('.'))|cbor}" -R a -l1 | "$PYTHON" "$TESTTMP/decodecbor.py" |
7333e8bb9781
templater: fix cbor() filter to recursively convert smartset to list
Yuya Nishihara <yuya@tcha.org>
parents:
44589
diff
changeset
|
1618 [ |
7333e8bb9781
templater: fix cbor() filter to recursively convert smartset to list
Yuya Nishihara <yuya@tcha.org>
parents:
44589
diff
changeset
|
1619 { |
7333e8bb9781
templater: fix cbor() filter to recursively convert smartset to list
Yuya Nishihara <yuya@tcha.org>
parents:
44589
diff
changeset
|
1620 'foo': [ |
7333e8bb9781
templater: fix cbor() filter to recursively convert smartset to list
Yuya Nishihara <yuya@tcha.org>
parents:
44589
diff
changeset
|
1621 10 |
7333e8bb9781
templater: fix cbor() filter to recursively convert smartset to list
Yuya Nishihara <yuya@tcha.org>
parents:
44589
diff
changeset
|
1622 ] |
7333e8bb9781
templater: fix cbor() filter to recursively convert smartset to list
Yuya Nishihara <yuya@tcha.org>
parents:
44589
diff
changeset
|
1623 } |
7333e8bb9781
templater: fix cbor() filter to recursively convert smartset to list
Yuya Nishihara <yuya@tcha.org>
parents:
44589
diff
changeset
|
1624 ] |
7333e8bb9781
templater: fix cbor() filter to recursively convert smartset to list
Yuya Nishihara <yuya@tcha.org>
parents:
44589
diff
changeset
|
1625 |
28212
d4419c01532b
templatefilters: make json filter be byte-transparent (BC) (issue4926)
Yuya Nishihara <yuya@tcha.org>
parents:
28209
diff
changeset
|
1626 json filter should escape HTML tags so that the output can be embedded in hgweb: |
d4419c01532b
templatefilters: make json filter be byte-transparent (BC) (issue4926)
Yuya Nishihara <yuya@tcha.org>
parents:
28209
diff
changeset
|
1627 |
d4419c01532b
templatefilters: make json filter be byte-transparent (BC) (issue4926)
Yuya Nishihara <yuya@tcha.org>
parents:
28209
diff
changeset
|
1628 $ hg log -T "{'<foo@example.org>'|json}\n" -R a -l1 |
d4419c01532b
templatefilters: make json filter be byte-transparent (BC) (issue4926)
Yuya Nishihara <yuya@tcha.org>
parents:
28209
diff
changeset
|
1629 "\u003cfoo@example.org\u003e" |
d4419c01532b
templatefilters: make json filter be byte-transparent (BC) (issue4926)
Yuya Nishihara <yuya@tcha.org>
parents:
28209
diff
changeset
|
1630 |
26856
baa77652be68
templatefilters: try round-trip utf-8 conversion by json filter (issue4933)
Yuya Nishihara <yuya@tcha.org>
parents:
26504
diff
changeset
|
1631 Set up repository for non-ascii encoding tests: |
baa77652be68
templatefilters: try round-trip utf-8 conversion by json filter (issue4933)
Yuya Nishihara <yuya@tcha.org>
parents:
26504
diff
changeset
|
1632 |
baa77652be68
templatefilters: try round-trip utf-8 conversion by json filter (issue4933)
Yuya Nishihara <yuya@tcha.org>
parents:
26504
diff
changeset
|
1633 $ hg init nonascii |
baa77652be68
templatefilters: try round-trip utf-8 conversion by json filter (issue4933)
Yuya Nishihara <yuya@tcha.org>
parents:
26504
diff
changeset
|
1634 $ cd nonascii |
39707
5abc47d4ca6b
tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents:
39367
diff
changeset
|
1635 $ "$PYTHON" <<EOF |
36504
b075f45456a5
py3: fix test-command-template.t to write files in binary mode
Yuya Nishihara <yuya@tcha.org>
parents:
36445
diff
changeset
|
1636 > open('latin1', 'wb').write(b'\xe9') |
b075f45456a5
py3: fix test-command-template.t to write files in binary mode
Yuya Nishihara <yuya@tcha.org>
parents:
36445
diff
changeset
|
1637 > open('utf-8', 'wb').write(b'\xc3\xa9') |
26856
baa77652be68
templatefilters: try round-trip utf-8 conversion by json filter (issue4933)
Yuya Nishihara <yuya@tcha.org>
parents:
26504
diff
changeset
|
1638 > EOF |
baa77652be68
templatefilters: try round-trip utf-8 conversion by json filter (issue4933)
Yuya Nishihara <yuya@tcha.org>
parents:
26504
diff
changeset
|
1639 $ HGENCODING=utf-8 hg branch -q `cat utf-8` |
28239
7279e0132347
templatekw: workaround for utf-8 round-trip of {desc}
Yuya Nishihara <yuya@tcha.org>
parents:
28212
diff
changeset
|
1640 $ HGENCODING=utf-8 hg ci -qAm "non-ascii branch: `cat utf-8`" utf-8 |
26856
baa77652be68
templatefilters: try round-trip utf-8 conversion by json filter (issue4933)
Yuya Nishihara <yuya@tcha.org>
parents:
26504
diff
changeset
|
1641 |
baa77652be68
templatefilters: try round-trip utf-8 conversion by json filter (issue4933)
Yuya Nishihara <yuya@tcha.org>
parents:
26504
diff
changeset
|
1642 json filter should try round-trip conversion to utf-8: |
baa77652be68
templatefilters: try round-trip utf-8 conversion by json filter (issue4933)
Yuya Nishihara <yuya@tcha.org>
parents:
26504
diff
changeset
|
1643 |
baa77652be68
templatefilters: try round-trip utf-8 conversion by json filter (issue4933)
Yuya Nishihara <yuya@tcha.org>
parents:
26504
diff
changeset
|
1644 $ HGENCODING=ascii hg log -T "{branch|json}\n" -r0 |
baa77652be68
templatefilters: try round-trip utf-8 conversion by json filter (issue4933)
Yuya Nishihara <yuya@tcha.org>
parents:
26504
diff
changeset
|
1645 "\u00e9" |
28239
7279e0132347
templatekw: workaround for utf-8 round-trip of {desc}
Yuya Nishihara <yuya@tcha.org>
parents:
28212
diff
changeset
|
1646 $ HGENCODING=ascii hg log -T "{desc|json}\n" -r0 |
7279e0132347
templatekw: workaround for utf-8 round-trip of {desc}
Yuya Nishihara <yuya@tcha.org>
parents:
28212
diff
changeset
|
1647 "non-ascii branch: \u00e9" |
26856
baa77652be68
templatefilters: try round-trip utf-8 conversion by json filter (issue4933)
Yuya Nishihara <yuya@tcha.org>
parents:
26504
diff
changeset
|
1648 |
37947
3ea3c96ada54
encoding: introduce tagging type for non-lossy non-ASCII string
Yuya Nishihara <yuya@tcha.org>
parents:
37859
diff
changeset
|
1649 json filter should take input as utf-8 if it was converted from utf-8: |
3ea3c96ada54
encoding: introduce tagging type for non-lossy non-ASCII string
Yuya Nishihara <yuya@tcha.org>
parents:
37859
diff
changeset
|
1650 |
3ea3c96ada54
encoding: introduce tagging type for non-lossy non-ASCII string
Yuya Nishihara <yuya@tcha.org>
parents:
37859
diff
changeset
|
1651 $ HGENCODING=latin-1 hg log -T "{branch|json}\n" -r0 |
3ea3c96ada54
encoding: introduce tagging type for non-lossy non-ASCII string
Yuya Nishihara <yuya@tcha.org>
parents:
37859
diff
changeset
|
1652 "\u00e9" |
3ea3c96ada54
encoding: introduce tagging type for non-lossy non-ASCII string
Yuya Nishihara <yuya@tcha.org>
parents:
37859
diff
changeset
|
1653 $ HGENCODING=latin-1 hg log -T "{desc|json}\n" -r0 |
3ea3c96ada54
encoding: introduce tagging type for non-lossy non-ASCII string
Yuya Nishihara <yuya@tcha.org>
parents:
37859
diff
changeset
|
1654 "non-ascii branch: \u00e9" |
3ea3c96ada54
encoding: introduce tagging type for non-lossy non-ASCII string
Yuya Nishihara <yuya@tcha.org>
parents:
37859
diff
changeset
|
1655 |
28212
d4419c01532b
templatefilters: make json filter be byte-transparent (BC) (issue4926)
Yuya Nishihara <yuya@tcha.org>
parents:
28209
diff
changeset
|
1656 json filter takes input as utf-8b: |
26856
baa77652be68
templatefilters: try round-trip utf-8 conversion by json filter (issue4933)
Yuya Nishihara <yuya@tcha.org>
parents:
26504
diff
changeset
|
1657 |
baa77652be68
templatefilters: try round-trip utf-8 conversion by json filter (issue4933)
Yuya Nishihara <yuya@tcha.org>
parents:
26504
diff
changeset
|
1658 $ HGENCODING=ascii hg log -T "{'`cat utf-8`'|json}\n" -l1 |
28212
d4419c01532b
templatefilters: make json filter be byte-transparent (BC) (issue4926)
Yuya Nishihara <yuya@tcha.org>
parents:
28209
diff
changeset
|
1659 "\u00e9" |
d4419c01532b
templatefilters: make json filter be byte-transparent (BC) (issue4926)
Yuya Nishihara <yuya@tcha.org>
parents:
28209
diff
changeset
|
1660 $ HGENCODING=ascii hg log -T "{'`cat latin1`'|json}\n" -l1 |
d4419c01532b
templatefilters: make json filter be byte-transparent (BC) (issue4926)
Yuya Nishihara <yuya@tcha.org>
parents:
28209
diff
changeset
|
1661 "\udce9" |
26856
baa77652be68
templatefilters: try round-trip utf-8 conversion by json filter (issue4933)
Yuya Nishihara <yuya@tcha.org>
parents:
26504
diff
changeset
|
1662 |
42480
b6387a65851d
cborutil: fix streamencode() to handle subtypes
Yuya Nishihara <yuya@tcha.org>
parents:
42000
diff
changeset
|
1663 cbor filter is bytes transparent, which should handle bytes subtypes |
b6387a65851d
cborutil: fix streamencode() to handle subtypes
Yuya Nishihara <yuya@tcha.org>
parents:
42000
diff
changeset
|
1664 as bytes: |
b6387a65851d
cborutil: fix streamencode() to handle subtypes
Yuya Nishihara <yuya@tcha.org>
parents:
42000
diff
changeset
|
1665 |
b6387a65851d
cborutil: fix streamencode() to handle subtypes
Yuya Nishihara <yuya@tcha.org>
parents:
42000
diff
changeset
|
1666 $ HGENCODING=ascii hg log -T "{branch|cbor}" -r0 \ |
b6387a65851d
cborutil: fix streamencode() to handle subtypes
Yuya Nishihara <yuya@tcha.org>
parents:
42000
diff
changeset
|
1667 > | "$PYTHON" "$TESTTMP/decodecbor.py" |
b6387a65851d
cborutil: fix streamencode() to handle subtypes
Yuya Nishihara <yuya@tcha.org>
parents:
42000
diff
changeset
|
1668 [ |
b6387a65851d
cborutil: fix streamencode() to handle subtypes
Yuya Nishihara <yuya@tcha.org>
parents:
42000
diff
changeset
|
1669 '?' |
b6387a65851d
cborutil: fix streamencode() to handle subtypes
Yuya Nishihara <yuya@tcha.org>
parents:
42000
diff
changeset
|
1670 ] |
b6387a65851d
cborutil: fix streamencode() to handle subtypes
Yuya Nishihara <yuya@tcha.org>
parents:
42000
diff
changeset
|
1671 $ HGENCODING=latin-1 hg log -T "{branch|cbor}" -r0 \ |
b6387a65851d
cborutil: fix streamencode() to handle subtypes
Yuya Nishihara <yuya@tcha.org>
parents:
42000
diff
changeset
|
1672 > | "$PYTHON" "$TESTTMP/decodecbor.py" |
b6387a65851d
cborutil: fix streamencode() to handle subtypes
Yuya Nishihara <yuya@tcha.org>
parents:
42000
diff
changeset
|
1673 [ |
b6387a65851d
cborutil: fix streamencode() to handle subtypes
Yuya Nishihara <yuya@tcha.org>
parents:
42000
diff
changeset
|
1674 '\xe9' |
b6387a65851d
cborutil: fix streamencode() to handle subtypes
Yuya Nishihara <yuya@tcha.org>
parents:
42000
diff
changeset
|
1675 ] |
b6387a65851d
cborutil: fix streamencode() to handle subtypes
Yuya Nishihara <yuya@tcha.org>
parents:
42000
diff
changeset
|
1676 |
28209
8ddf893560fa
templatefilters: add "utf8" to get utf-8 bytes from local-encoding text
Yuya Nishihara <yuya@tcha.org>
parents:
28177
diff
changeset
|
1677 utf8 filter: |
8ddf893560fa
templatefilters: add "utf8" to get utf-8 bytes from local-encoding text
Yuya Nishihara <yuya@tcha.org>
parents:
28177
diff
changeset
|
1678 |
8ddf893560fa
templatefilters: add "utf8" to get utf-8 bytes from local-encoding text
Yuya Nishihara <yuya@tcha.org>
parents:
28177
diff
changeset
|
1679 $ HGENCODING=ascii hg log -T "round-trip: {branch|utf8|hex}\n" -r0 |
8ddf893560fa
templatefilters: add "utf8" to get utf-8 bytes from local-encoding text
Yuya Nishihara <yuya@tcha.org>
parents:
28177
diff
changeset
|
1680 round-trip: c3a9 |
8ddf893560fa
templatefilters: add "utf8" to get utf-8 bytes from local-encoding text
Yuya Nishihara <yuya@tcha.org>
parents:
28177
diff
changeset
|
1681 $ HGENCODING=latin1 hg log -T "decoded: {'`cat latin1`'|utf8|hex}\n" -l1 |
8ddf893560fa
templatefilters: add "utf8" to get utf-8 bytes from local-encoding text
Yuya Nishihara <yuya@tcha.org>
parents:
28177
diff
changeset
|
1682 decoded: c3a9 |
8ddf893560fa
templatefilters: add "utf8" to get utf-8 bytes from local-encoding text
Yuya Nishihara <yuya@tcha.org>
parents:
28177
diff
changeset
|
1683 $ HGENCODING=ascii hg log -T "replaced: {'`cat latin1`'|utf8|hex}\n" -l1 |
8ddf893560fa
templatefilters: add "utf8" to get utf-8 bytes from local-encoding text
Yuya Nishihara <yuya@tcha.org>
parents:
28177
diff
changeset
|
1684 abort: decoding near * (glob) |
8ddf893560fa
templatefilters: add "utf8" to get utf-8 bytes from local-encoding text
Yuya Nishihara <yuya@tcha.org>
parents:
28177
diff
changeset
|
1685 [255] |
37223
08e042f0a67c
templatefilters: declare input type as bytes where appropriate
Yuya Nishihara <yuya@tcha.org>
parents:
37105
diff
changeset
|
1686 $ hg log -T "coerced to string: {rev|utf8}\n" -r0 |
08e042f0a67c
templatefilters: declare input type as bytes where appropriate
Yuya Nishihara <yuya@tcha.org>
parents:
37105
diff
changeset
|
1687 coerced to string: 0 |
28209
8ddf893560fa
templatefilters: add "utf8" to get utf-8 bytes from local-encoding text
Yuya Nishihara <yuya@tcha.org>
parents:
28177
diff
changeset
|
1688 |
31520
6f150bb19317
templater: make pad() compute actual width
Yuya Nishihara <yuya@tcha.org>
parents:
31519
diff
changeset
|
1689 pad width: |
6f150bb19317
templater: make pad() compute actual width
Yuya Nishihara <yuya@tcha.org>
parents:
31519
diff
changeset
|
1690 |
6f150bb19317
templater: make pad() compute actual width
Yuya Nishihara <yuya@tcha.org>
parents:
31519
diff
changeset
|
1691 $ HGENCODING=utf-8 hg debugtemplate "{pad('`cat utf-8`', 2, '-')}\n" |
6f150bb19317
templater: make pad() compute actual width
Yuya Nishihara <yuya@tcha.org>
parents:
31519
diff
changeset
|
1692 \xc3\xa9- (esc) |
6f150bb19317
templater: make pad() compute actual width
Yuya Nishihara <yuya@tcha.org>
parents:
31519
diff
changeset
|
1693 |
41720
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1694 read config options: |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1695 |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1696 $ hg log -T "{config('templateconfig', 'knob', 'foo')}\n" |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1697 foo |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1698 $ hg log -T "{config('templateconfig', 'knob', 'foo')}\n" \ |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1699 > --config templateconfig.knob=bar |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1700 bar |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1701 $ hg log -T "{configbool('templateconfig', 'knob', True)}\n" |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1702 True |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1703 $ hg log -T "{configbool('templateconfig', 'knob', True)}\n" \ |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1704 > --config templateconfig.knob=0 |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1705 False |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1706 $ hg log -T "{configint('templateconfig', 'knob', 123)}\n" |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1707 123 |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1708 $ hg log -T "{configint('templateconfig', 'knob', 123)}\n" \ |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1709 > --config templateconfig.knob=456 |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1710 456 |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1711 $ hg log -T "{config('templateconfig', 'knob')}\n" |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1712 devel-warn: config item requires an explicit default value: 'templateconfig.knob' at: * (glob) |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1713 |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1714 $ hg log -T "{configbool('ui', 'interactive')}\n" |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1715 False |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1716 $ hg log -T "{configbool('ui', 'interactive')}\n" --config ui.interactive=1 |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1717 True |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1718 $ hg log -T "{config('templateconfig', 'knob', if(true, 'foo', 'bar'))}\n" |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1719 foo |
6704696141b8
templates: adding a config() function for template customization
rdamazio@google.com
parents:
40935
diff
changeset
|
1720 |
49494
c96ed4029fda
templates: add filter to reverse list
Manuel Jacob <me@manueljacob.de>
parents:
48879
diff
changeset
|
1721 reverse filter: |
c96ed4029fda
templates: add filter to reverse list
Manuel Jacob <me@manueljacob.de>
parents:
48879
diff
changeset
|
1722 |
c96ed4029fda
templates: add filter to reverse list
Manuel Jacob <me@manueljacob.de>
parents:
48879
diff
changeset
|
1723 $ hg log -T "{'abc\ndef\nghi'|splitlines|reverse}\n" |
c96ed4029fda
templates: add filter to reverse list
Manuel Jacob <me@manueljacob.de>
parents:
48879
diff
changeset
|
1724 ghi def abc |
c96ed4029fda
templates: add filter to reverse list
Manuel Jacob <me@manueljacob.de>
parents:
48879
diff
changeset
|
1725 |
c96ed4029fda
templates: add filter to reverse list
Manuel Jacob <me@manueljacob.de>
parents:
48879
diff
changeset
|
1726 $ hg log -T "{'abc'|reverse}\n" |
c96ed4029fda
templates: add filter to reverse list
Manuel Jacob <me@manueljacob.de>
parents:
48879
diff
changeset
|
1727 hg: parse error: not reversible |
c96ed4029fda
templates: add filter to reverse list
Manuel Jacob <me@manueljacob.de>
parents:
48879
diff
changeset
|
1728 (incompatible use of template filter 'reverse') |
c96ed4029fda
templates: add filter to reverse list
Manuel Jacob <me@manueljacob.de>
parents:
48879
diff
changeset
|
1729 [10] |
c96ed4029fda
templates: add filter to reverse list
Manuel Jacob <me@manueljacob.de>
parents:
48879
diff
changeset
|
1730 |
c96ed4029fda
templates: add filter to reverse list
Manuel Jacob <me@manueljacob.de>
parents:
48879
diff
changeset
|
1731 $ hg log -T "{date|reverse}\n" |
c96ed4029fda
templates: add filter to reverse list
Manuel Jacob <me@manueljacob.de>
parents:
48879
diff
changeset
|
1732 hg: parse error: not reversible |
c96ed4029fda
templates: add filter to reverse list
Manuel Jacob <me@manueljacob.de>
parents:
48879
diff
changeset
|
1733 (template filter 'reverse' is not compatible with keyword 'date') |
c96ed4029fda
templates: add filter to reverse list
Manuel Jacob <me@manueljacob.de>
parents:
48879
diff
changeset
|
1734 [10] |
c96ed4029fda
templates: add filter to reverse list
Manuel Jacob <me@manueljacob.de>
parents:
48879
diff
changeset
|
1735 |
26856
baa77652be68
templatefilters: try round-trip utf-8 conversion by json filter (issue4933)
Yuya Nishihara <yuya@tcha.org>
parents:
26504
diff
changeset
|
1736 $ cd .. |