annotate tests/test-grep @ 11465:ace5bd98bee3 stable

heads: fix templating of headers again (issue2130) (tweaks and test by mpm)
author Simon Howkins <simonh@symbian.org>
date Thu, 24 Jun 2010 15:18:47 +0100
parents df5d1d571d27
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1146
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
1 #!/bin/sh
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
2
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
3 mkdir t
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
4 cd t
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
5 hg init
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
6 echo import > port
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
7 hg add port
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
8 hg commit -m 0 -u spam -d '0 0'
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
9 echo export >> port
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
10 hg commit -m 1 -u eggs -d '1 0'
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
11 echo export > port
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
12 echo vaportight >> port
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
13 echo 'import/export' >> port
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
14 hg commit -m 2 -u spam -d '2 0'
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
15 echo 'import/export' >> port
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
16 hg commit -m 3 -u eggs -d '3 0'
1539
5e47e42b14ba use posix compliant option for head
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1212
diff changeset
17 head -n 3 port > port1
1146
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
18 mv port1 port
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
19 hg commit -m 4 -u spam -d '4 0'
4877
242026115e6a hg grep: handle re.compile errors & update tests/test-grep
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3951
diff changeset
20 echo % pattern error
242026115e6a hg grep: handle re.compile errors & update tests/test-grep
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3951
diff changeset
21 hg grep '**test**'
3950
3d3007064a17 grep: incrementing is always False during 'iter'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2870
diff changeset
22 echo % simple
1146
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
23 hg grep port port
10826
717c35d55fb3 color: colorize based on output labels instead of parsing output
Brodie Rao <brodie@bitheap.org>
parents: 9367
diff changeset
24 echo % simple with color
11141
df5d1d571d27 tests: force color ansi mode on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 10826
diff changeset
25 hg --config extensions.color= grep --config color.mode=ansi \
df5d1d571d27 tests: force color ansi mode on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 10826
diff changeset
26 --color=always port port
3950
3d3007064a17 grep: incrementing is always False during 'iter'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2870
diff changeset
27 echo % all
9367
1ef630452e0b cmdutil: use context objects for walkchangerevs()
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8897
diff changeset
28 hg grep --traceback --all -nu port port
3950
3d3007064a17 grep: incrementing is always False during 'iter'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2870
diff changeset
29 echo % other
1146
9061f79c6c6f grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff changeset
30 hg grep import port
2870
8eaaf1321bfe grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents: 2869
diff changeset
31
8eaaf1321bfe grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents: 2869
diff changeset
32 hg cp port port2
8eaaf1321bfe grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents: 2869
diff changeset
33 hg commit -m 4 -u spam -d '5 0'
9367
1ef630452e0b cmdutil: use context objects for walkchangerevs()
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8897
diff changeset
34 echo % follow
1ef630452e0b cmdutil: use context objects for walkchangerevs()
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8897
diff changeset
35 hg grep --traceback -f 'import$' port2
2870
8eaaf1321bfe grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents: 2869
diff changeset
36 echo deport >> port2
8eaaf1321bfe grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents: 2869
diff changeset
37 hg commit -m 5 -u eggs -d '6 0'
8eaaf1321bfe grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents: 2869
diff changeset
38 hg grep -f --all -nu port port2
3951
cb66641cdee3 grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3950
diff changeset
39
cb66641cdee3 grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3950
diff changeset
40 cd ..
cb66641cdee3 grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3950
diff changeset
41 hg init t2
cb66641cdee3 grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3950
diff changeset
42 cd t2
cb66641cdee3 grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3950
diff changeset
43 hg grep foobar foo
cb66641cdee3 grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3950
diff changeset
44 hg grep foobar
cb66641cdee3 grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3950
diff changeset
45 echo blue >> color
cb66641cdee3 grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3950
diff changeset
46 echo black >> color
cb66641cdee3 grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3950
diff changeset
47 hg add color
8167
6c82beaaa11a tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7240
diff changeset
48 hg ci -m 0
3951
cb66641cdee3 grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3950
diff changeset
49 echo orange >> color
8167
6c82beaaa11a tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7240
diff changeset
50 hg ci -m 1
3951
cb66641cdee3 grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3950
diff changeset
51 echo black > color
8167
6c82beaaa11a tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7240
diff changeset
52 hg ci -m 2
3951
cb66641cdee3 grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3950
diff changeset
53 echo orange >> color
cb66641cdee3 grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3950
diff changeset
54 echo blue >> color
8167
6c82beaaa11a tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7240
diff changeset
55 hg ci -m 3
3951
cb66641cdee3 grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3950
diff changeset
56 hg grep orange
cb66641cdee3 grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3950
diff changeset
57 hg grep --all orange
5106
ee702e7f181f test-grep: test issue 685
Patrick Mezard <pmezard@gmail.com>
parents: 4877
diff changeset
58
7240
dac14cc9711e test 261a9f47b44b: grep w/ match in last line w/o newline
Christian Ebert <blacktrash@gmx.net>
parents: 5107
diff changeset
59 echo % match in last "line" without newline
dac14cc9711e test 261a9f47b44b: grep w/ match in last line w/o newline
Christian Ebert <blacktrash@gmx.net>
parents: 5107
diff changeset
60 python -c 'fp = open("noeol", "wb"); fp.write("no infinite loop"); fp.close();'
dac14cc9711e test 261a9f47b44b: grep w/ match in last line w/o newline
Christian Ebert <blacktrash@gmx.net>
parents: 5107
diff changeset
61 hg ci -Amnoeol
dac14cc9711e test 261a9f47b44b: grep w/ match in last line w/o newline
Christian Ebert <blacktrash@gmx.net>
parents: 5107
diff changeset
62 echo % last character omitted in output to avoid infinite loop
dac14cc9711e test 261a9f47b44b: grep w/ match in last line w/o newline
Christian Ebert <blacktrash@gmx.net>
parents: 5107
diff changeset
63 hg grep loop
dac14cc9711e test 261a9f47b44b: grep w/ match in last line w/o newline
Christian Ebert <blacktrash@gmx.net>
parents: 5107
diff changeset
64
5106
ee702e7f181f test-grep: test issue 685
Patrick Mezard <pmezard@gmail.com>
parents: 4877
diff changeset
65 # Got a traceback when using grep on a single
ee702e7f181f test-grep: test issue 685
Patrick Mezard <pmezard@gmail.com>
parents: 4877
diff changeset
66 # revision with renamed files.
ee702e7f181f test-grep: test issue 685
Patrick Mezard <pmezard@gmail.com>
parents: 4877
diff changeset
67 cd ..
ee702e7f181f test-grep: test issue 685
Patrick Mezard <pmezard@gmail.com>
parents: 4877
diff changeset
68 echo % issue 685
ee702e7f181f test-grep: test issue 685
Patrick Mezard <pmezard@gmail.com>
parents: 4877
diff changeset
69 hg init issue685
ee702e7f181f test-grep: test issue 685
Patrick Mezard <pmezard@gmail.com>
parents: 4877
diff changeset
70 cd issue685
ee702e7f181f test-grep: test issue 685
Patrick Mezard <pmezard@gmail.com>
parents: 4877
diff changeset
71 echo octarine > color
ee702e7f181f test-grep: test issue 685
Patrick Mezard <pmezard@gmail.com>
parents: 4877
diff changeset
72 hg ci -Amcolor
ee702e7f181f test-grep: test issue 685
Patrick Mezard <pmezard@gmail.com>
parents: 4877
diff changeset
73 hg rename color colour
5107
0edea751bbb2 test-grep: use lowercase hg command
Matt Mackall <mpm@selenic.com>
parents: 5106
diff changeset
74 hg ci -Am rename
5106
ee702e7f181f test-grep: test issue 685
Patrick Mezard <pmezard@gmail.com>
parents: 4877
diff changeset
75 hg grep octarine
ee702e7f181f test-grep: test issue 685
Patrick Mezard <pmezard@gmail.com>
parents: 4877
diff changeset
76 # Used to crash here
ee702e7f181f test-grep: test issue 685
Patrick Mezard <pmezard@gmail.com>
parents: 4877
diff changeset
77 hg grep -r 1 octarine
7240
dac14cc9711e test 261a9f47b44b: grep w/ match in last line w/o newline
Christian Ebert <blacktrash@gmx.net>
parents: 5107
diff changeset
78
8897
aa78a0583731 test-grep: fixed comment
Martin Geisler <mg@lazybytes.net>
parents: 8849
diff changeset
79 # Issue337: test that grep follows parent-child relationships instead
aa78a0583731 test-grep: fixed comment
Martin Geisler <mg@lazybytes.net>
parents: 8849
diff changeset
80 # of just using revision numbers.
8849
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
81 cd ..
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
82 echo % issue 337
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
83 hg init issue337
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
84 cd issue337
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
85
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
86 echo white > color
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
87 hg commit -A -m "0 white"
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
88
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
89 echo red > color
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
90 hg commit -A -m "1 red"
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
91
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
92 hg update 0
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
93 echo black > color
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
94 hg commit -A -m "2 black"
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
95
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
96 hg update --clean 1
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
97 echo blue > color
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
98 hg commit -A -m "3 blue"
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
99
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
100 hg grep --all red