21 grep: invalid match pattern: nothing to repeat |
21 grep: invalid match pattern: nothing to repeat |
22 [1] |
22 [1] |
23 |
23 |
24 simple |
24 simple |
25 |
25 |
26 $ hg grep '.*' |
26 $ hg grep -r tip:0 '.*' |
27 port:4:export |
27 port:4:export |
28 port:4:vaportight |
28 port:4:vaportight |
29 port:4:import/export |
29 port:4:import/export |
30 $ hg grep port port |
30 $ hg grep -r tip:0 port port |
31 port:4:export |
31 port:4:export |
32 port:4:vaportight |
32 port:4:vaportight |
33 port:4:import/export |
33 port:4:import/export |
34 |
34 |
35 simple with color |
35 simple with color |
36 |
36 |
37 $ hg --config extensions.color= grep --config color.mode=ansi \ |
37 $ hg --config extensions.color= grep --config color.mode=ansi \ |
38 > --color=always port port |
38 > --color=always port port -r tip:0 |
39 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m4\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc) |
39 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m4\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc) |
40 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m4\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might (esc) |
40 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m4\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might (esc) |
41 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m4\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc) |
41 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m4\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc) |
42 |
42 |
43 simple templated |
43 simple templated |
44 |
44 |
45 $ hg grep port \ |
45 $ hg grep port -r tip:0 \ |
46 > -T '{file}:{rev}:{node|short}:{texts % "{if(matched, text|upper, text)}"}\n' |
46 > -T '{file}:{rev}:{node|short}:{texts % "{if(matched, text|upper, text)}"}\n' |
47 port:4:914fa752cdea:exPORT |
47 port:4:914fa752cdea:exPORT |
48 port:4:914fa752cdea:vaPORTight |
48 port:4:914fa752cdea:vaPORTight |
49 port:4:914fa752cdea:imPORT/exPORT |
49 port:4:914fa752cdea:imPORT/exPORT |
50 |
50 |
51 $ hg grep port -T '{file}:{rev}:{texts}\n' |
51 $ hg grep port -r tip:0 -T '{file}:{rev}:{texts}\n' |
52 port:4:export |
52 port:4:export |
53 port:4:vaportight |
53 port:4:vaportight |
54 port:4:import/export |
54 port:4:import/export |
55 |
55 |
56 $ hg grep port -T '{file}:{tags}:{texts}\n' |
56 $ hg grep port -r tip:0 -T '{file}:{tags}:{texts}\n' |
57 port:tip:export |
57 port:tip:export |
58 port:tip:vaportight |
58 port:tip:vaportight |
59 port:tip:import/export |
59 port:tip:import/export |
60 |
60 |
61 simple JSON (no "change" field) |
61 simple JSON (no "change" field) |
62 |
62 |
63 $ hg grep -Tjson port |
63 $ hg grep -r tip:0 -Tjson port |
64 [ |
64 [ |
65 { |
65 { |
66 "date": [4, 0], |
66 "date": [4, 0], |
67 "file": "port", |
67 "file": "port", |
68 "line_number": 1, |
68 "line_number": 1, |
214 } |
214 } |
215 ] |
215 ] |
216 |
216 |
217 other |
217 other |
218 |
218 |
219 $ hg grep -l port port |
219 $ hg grep -r tip:0 -l port port |
220 port:4 |
220 port:4 |
221 $ hg grep import port |
221 $ hg grep -r tip:0 import port |
222 port:4:import/export |
222 port:4:import/export |
223 |
223 |
224 $ hg cp port port2 |
224 $ hg cp port port2 |
225 $ hg commit -m 4 -u spam -d '5 0' |
225 $ hg commit -m 4 -u spam -d '5 0' |
226 |
226 |
227 follow |
227 follow |
228 |
228 |
229 $ hg grep --traceback -f 'import\n\Z' port2 |
229 $ hg grep -r tip:0 --traceback -f 'import\n\Z' port2 |
230 port:0:import |
230 port:0:import |
231 |
231 |
232 $ echo deport >> port2 |
232 $ echo deport >> port2 |
233 $ hg commit -m 5 -u eggs -d '6 0' |
233 $ hg commit -m 5 -u eggs -d '6 0' |
234 $ hg grep -f --all -nu port port2 |
234 $ hg grep -f --all -nu port port2 |
291 color:2:-:orange |
291 color:2:-:orange |
292 color:1:+:orange |
292 color:1:+:orange |
293 |
293 |
294 test substring match: '^' should only match at the beginning |
294 test substring match: '^' should only match at the beginning |
295 |
295 |
296 $ hg grep '^.' --config extensions.color= --color debug |
296 $ hg grep -r tip:0 '^.' --config extensions.color= --color debug |
297 [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|b]lack |
297 [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|b]lack |
298 [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|o]range |
298 [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|o]range |
299 [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|b]lue |
299 [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|b]lue |
300 |
300 |
301 match in last "line" without newline |
301 match in last "line" without newline |
302 |
302 |
303 $ $PYTHON -c 'fp = open("noeol", "wb"); fp.write(b"no infinite loop"); fp.close();' |
303 $ $PYTHON -c 'fp = open("noeol", "wb"); fp.write(b"no infinite loop"); fp.close();' |
304 $ hg ci -Amnoeol |
304 $ hg ci -Amnoeol |
305 adding noeol |
305 adding noeol |
306 $ hg grep loop |
306 $ hg grep -r tip:0 loop |
307 noeol:4:no infinite loop |
307 noeol:4:no infinite loop |
308 |
308 |
309 $ cd .. |
309 $ cd .. |
310 |
310 |
311 Issue685: traceback in grep -r after rename |
311 Issue685: traceback in grep -r after rename |
422 $ hg add a |
422 $ hg add a |
423 $ hg grep -r "wdir()" "abra" |
423 $ hg grep -r "wdir()" "abra" |
424 a:2147483647:abracadara |
424 a:2147483647:abracadara |
425 |
425 |
426 $ cd .. |
426 $ cd .. |
|
427 |
|
428 Change Default of grep, that is, the files not in current working directory |
|
429 should not be grepp-ed on |
|
430 $ hg init ab |
|
431 $ cd ab |
|
432 $ echo "some text">>file1 |
|
433 $ hg add file1 |
|
434 $ hg commit -m "adds file1" |
|
435 $ hg mv file1 file2 |
|
436 $ hg grep "some" |
|
437 file2:2147483647:some text |