annotate tests/test-command-template @ 5432:0d154bce2341

osutil: Solaris build fix
author Bryan O'Sullivan <bos@serpentine.com>
date Tue, 09 Oct 2007 08:39:37 -0700
parents 3cf94964c56b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
1 #!/bin/sh
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
2
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
3 hg init a
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
4 cd a
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
5 echo a > a
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
6 hg add a
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
7 echo line 1 > b
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
8 echo line 2 >> b
1939
d59fc0d4558f Use timestamps without leading 0 in test-command-template for portable tests.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1918
diff changeset
9 hg commit -l b -d '1000000 0' -u 'User Name <user@hostname>'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
10 hg add b
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
11 echo other 1 > c
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
12 echo other 2 >> c
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
13 echo >> c
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
14 echo other 3 >> c
1939
d59fc0d4558f Use timestamps without leading 0 in test-command-template for portable tests.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1918
diff changeset
15 hg commit -l c -d '1100000 0' -u 'A. N. Other <other@place>'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
16 hg add c
1939
d59fc0d4558f Use timestamps without leading 0 in test-command-template for portable tests.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1918
diff changeset
17 hg commit -m 'no person' -d '1200000 0' -u 'other@place'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
18 echo c >> c
1939
d59fc0d4558f Use timestamps without leading 0 in test-command-template for portable tests.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1918
diff changeset
19 hg commit -m 'no user, no domain' -d '1300000 0' -u 'person'
3458
031aac7ec584 Extended templating test for new branches and extra changeset info.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3454
diff changeset
20 echo foo > .hg/branch
031aac7ec584 Extended templating test for new branches and extra changeset info.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3454
diff changeset
21 hg commit -m 'new branch' -d '1400000 0' -u 'person'
4352
5e857d72d3ac test-command-template: improve test coverage
TK Soh <teekaysoh@yahoo.com>
parents: 4351
diff changeset
22 hg co -q 3
5e857d72d3ac test-command-template: improve test coverage
TK Soh <teekaysoh@yahoo.com>
parents: 4351
diff changeset
23 echo other 4 >> d
5e857d72d3ac test-command-template: improve test coverage
TK Soh <teekaysoh@yahoo.com>
parents: 4351
diff changeset
24 hg add d
5e857d72d3ac test-command-template: improve test coverage
TK Soh <teekaysoh@yahoo.com>
parents: 4351
diff changeset
25 hg commit -m 'new head' -d '1500000 0' -u 'person'
5e857d72d3ac test-command-template: improve test coverage
TK Soh <teekaysoh@yahoo.com>
parents: 4351
diff changeset
26 hg merge -q
5e857d72d3ac test-command-template: improve test coverage
TK Soh <teekaysoh@yahoo.com>
parents: 4351
diff changeset
27 hg commit -m 'merge' -d '1500001 0' -u 'person'
4842
3cf94964c56b hg log: Move filtering implicit parents to own method and use it in templater.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4352
diff changeset
28 # second branch starting at nullrev
3cf94964c56b hg log: Move filtering implicit parents to own method and use it in templater.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4352
diff changeset
29 hg update null
3cf94964c56b hg log: Move filtering implicit parents to own method and use it in templater.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4352
diff changeset
30 echo second > second
3cf94964c56b hg log: Move filtering implicit parents to own method and use it in templater.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4352
diff changeset
31 hg add second
3cf94964c56b hg log: Move filtering implicit parents to own method and use it in templater.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4352
diff changeset
32 hg commit -m second -d '1000000 0' -u 'User Name <user@hostname>'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
33
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
34 # make sure user/global hgrc does not affect tests
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
35 echo '[ui]' > .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
36 echo 'logtemplate =' >> .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
37 echo 'style =' >> .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
38
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
39 echo '# default style is like normal output'
3454
0600d326d96a Adjust default cmdline style to really match verbose/debug log.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3186
diff changeset
40 echo '# normal'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
41 hg log > log.out
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
42 hg log --style default > style.out
1916
95b2e14841f5 fix test failures that depend on when tests run.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1915
diff changeset
43 diff log.out style.out
3454
0600d326d96a Adjust default cmdline style to really match verbose/debug log.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3186
diff changeset
44 echo '# verbose'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
45 hg log -v > log.out
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
46 hg log -v --style default > style.out
1916
95b2e14841f5 fix test failures that depend on when tests run.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1915
diff changeset
47 diff log.out style.out
3454
0600d326d96a Adjust default cmdline style to really match verbose/debug log.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3186
diff changeset
48 echo '# debug'
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
49 hg log --debug > log.out
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
50 hg log --debug --style default > style.out
1916
95b2e14841f5 fix test failures that depend on when tests run.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1915
diff changeset
51 diff log.out style.out
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
52
4350
3380eb6d7c32 fix 'hg <not-log> -v --template foo' with revisions without copies
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
53 echo '# revision with no copies (used to print a traceback)'
3380eb6d7c32 fix 'hg <not-log> -v --template foo' with revisions without copies
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
54 hg tip -v --template '\n'
3380eb6d7c32 fix 'hg <not-log> -v --template foo' with revisions without copies
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
55
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
56 echo '# compact style works'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
57 hg log --style compact
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
58 hg log -v --style compact
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
59 hg log --debug --style compact
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
60
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
61 echo '# error if style not readable'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
62 touch q
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
63 chmod 0 q
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
64 hg log --style ./q
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
65
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
66 echo '# error if no style'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
67 hg log --style notexist
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
68
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
69 echo '# error if style missing key'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
70 echo 'q = q' > t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
71 hg log --style ./t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
72
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
73 echo '# error if include fails'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
74 echo 'changeset = q' >> t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
75 hg log --style ./t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
76
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
77 echo '# include works'
3988
9dcf9d45cab8 Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3458
diff changeset
78 rm q
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
79 echo '{rev}' > q
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
80 hg log --style ./t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
81
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
82 echo '# ui.style works'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
83 echo '[ui]' > .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
84 echo 'style = t' >> .hg/hgrc
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
85 hg log
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
86
3186
a6d0cd63068c Make "hg log --style=changelog > changelog" work (issue338)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1939
diff changeset
87 echo '# issue338'
a6d0cd63068c Make "hg log --style=changelog > changelog" work (issue338)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1939
diff changeset
88 hg log --style=changelog > changelog
a6d0cd63068c Make "hg log --style=changelog > changelog" work (issue338)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1939
diff changeset
89 cat changelog
a6d0cd63068c Make "hg log --style=changelog > changelog" work (issue338)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1939
diff changeset
90
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
91 echo "# keys work"
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
92 for key in author branches date desc file_adds file_dels files \
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
93 manifest node parents rev tags; do
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
94 for mode in '' --verbose --debug; do
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
95 hg log $mode --template "$key$mode: {$key}\n"
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
96 done
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
97 done
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
98
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
99 echo '# filters work'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
100 hg log --template '{author|domain}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
101 hg log --template '{author|person}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
102 hg log --template '{author|user}\n'
1916
95b2e14841f5 fix test failures that depend on when tests run.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1915
diff changeset
103 hg log --template '{date|age}\n' > /dev/null || exit 1
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
104 hg log --template '{date|date}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
105 hg log --template '{date|isodate}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
106 hg log --template '{date|rfc822date}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
107 hg log --template '{desc|firstline}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
108 hg log --template '{node|short}\n'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
109
4351
051fb8c2567c command line templates: add formatnode filter
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4350
diff changeset
110 echo '# formatnode filter works'
051fb8c2567c command line templates: add formatnode filter
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4350
diff changeset
111 echo '# quiet'
051fb8c2567c command line templates: add formatnode filter
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4350
diff changeset
112 hg -q log -r 0 --template '#node|formatnode#\n'
051fb8c2567c command line templates: add formatnode filter
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4350
diff changeset
113 echo '# normal'
051fb8c2567c command line templates: add formatnode filter
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4350
diff changeset
114 hg log -r 0 --template '#node|formatnode#\n'
051fb8c2567c command line templates: add formatnode filter
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4350
diff changeset
115 echo '# verbose'
051fb8c2567c command line templates: add formatnode filter
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4350
diff changeset
116 hg -v log -r 0 --template '#node|formatnode#\n'
051fb8c2567c command line templates: add formatnode filter
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4350
diff changeset
117 echo '# debug'
051fb8c2567c command line templates: add formatnode filter
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4350
diff changeset
118 hg --debug log -r 0 --template '#node|formatnode#\n'
051fb8c2567c command line templates: add formatnode filter
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4350
diff changeset
119
1915
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
120 echo '# error on syntax'
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
121 echo 'x = "f' >> t
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
122 hg log
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
123
9598cde4756d add tests for command line template.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
124 echo '# done'