Show More
@@ -1,100 +1,164 | |||
|
1 | #!/bin/sh | |
|
1 | $ mkdir t | |
|
2 | $ cd t | |
|
3 | $ hg init | |
|
4 | $ echo import > port | |
|
5 | $ hg add port | |
|
6 | $ hg commit -m 0 -u spam -d '0 0' | |
|
7 | $ echo export >> port | |
|
8 | $ hg commit -m 1 -u eggs -d '1 0' | |
|
9 | $ echo export > port | |
|
10 | $ echo vaportight >> port | |
|
11 | $ echo 'import/export' >> port | |
|
12 | $ hg commit -m 2 -u spam -d '2 0' | |
|
13 | $ echo 'import/export' >> port | |
|
14 | $ hg commit -m 3 -u eggs -d '3 0' | |
|
15 | $ head -n 3 port > port1 | |
|
16 | $ mv port1 port | |
|
17 | $ hg commit -m 4 -u spam -d '4 0' | |
|
18 | ||
|
19 | pattern error | |
|
20 | ||
|
21 | $ hg grep '**test**' | |
|
22 | grep: invalid match pattern: nothing to repeat | |
|
23 | ||
|
24 | simple | |
|
25 | ||
|
26 | $ hg grep port port | |
|
27 | port:4:export | |
|
28 | port:4:vaportight | |
|
29 | port:4:import/export | |
|
30 | ||
|
31 | simple with color | |
|
32 | ||
|
33 | $ hg --config extensions.color= grep --config color.mode=ansi \ | |
|
34 | > --color=always port port | |
|
35 | port:4:ex[0;31;1mport[0m | |
|
36 | port:4:va[0;31;1mport[0might | |
|
37 | port:4:im[0;31;1mport[0m/export | |
|
2 | 38 | |
|
3 | mkdir t | |
|
4 | cd t | |
|
5 | hg init | |
|
6 | echo import > port | |
|
7 | hg add port | |
|
8 | hg commit -m 0 -u spam -d '0 0' | |
|
9 | echo export >> port | |
|
10 | hg commit -m 1 -u eggs -d '1 0' | |
|
11 | echo export > port | |
|
12 | echo vaportight >> port | |
|
13 | echo 'import/export' >> port | |
|
14 | hg commit -m 2 -u spam -d '2 0' | |
|
15 | echo 'import/export' >> port | |
|
16 | hg commit -m 3 -u eggs -d '3 0' | |
|
17 | head -n 3 port > port1 | |
|
18 | mv port1 port | |
|
19 | hg commit -m 4 -u spam -d '4 0' | |
|
20 | echo % pattern error | |
|
21 | hg grep '**test**' | |
|
22 | echo % simple | |
|
23 | hg grep port port | |
|
24 | echo % simple with color | |
|
25 | hg --config extensions.color= grep --config color.mode=ansi \ | |
|
26 | --color=always port port | |
|
27 | echo % all | |
|
28 | hg grep --traceback --all -nu port port | |
|
29 | echo % other | |
|
30 | hg grep import port | |
|
39 | all | |
|
40 | ||
|
41 | $ hg grep --traceback --all -nu port port | |
|
42 | port:4:4:-:spam:import/export | |
|
43 | port:3:4:+:eggs:import/export | |
|
44 | port:2:1:-:spam:import | |
|
45 | port:2:2:-:spam:export | |
|
46 | port:2:1:+:spam:export | |
|
47 | port:2:2:+:spam:vaportight | |
|
48 | port:2:3:+:spam:import/export | |
|
49 | port:1:2:+:eggs:export | |
|
50 | port:0:1:+:spam:import | |
|
51 | ||
|
52 | other | |
|
53 | ||
|
54 | $ hg grep import port | |
|
55 | port:4:import/export | |
|
31 | 56 | |
|
32 | hg cp port port2 | |
|
33 | hg commit -m 4 -u spam -d '5 0' | |
|
34 | echo % follow | |
|
35 | hg grep --traceback -f 'import$' port2 | |
|
36 | echo deport >> port2 | |
|
37 | hg commit -m 5 -u eggs -d '6 0' | |
|
38 | hg grep -f --all -nu port port2 | |
|
57 | $ hg cp port port2 | |
|
58 | $ hg commit -m 4 -u spam -d '5 0' | |
|
59 | ||
|
60 | follow | |
|
61 | ||
|
62 | $ hg grep --traceback -f 'import$' port2 | |
|
63 | port:0:import | |
|
64 | $ echo deport >> port2 | |
|
65 | $ hg commit -m 5 -u eggs -d '6 0' | |
|
66 | $ hg grep -f --all -nu port port2 | |
|
67 | port2:6:4:+:eggs:deport | |
|
68 | port:4:4:-:spam:import/export | |
|
69 | port:3:4:+:eggs:import/export | |
|
70 | port:2:1:-:spam:import | |
|
71 | port:2:2:-:spam:export | |
|
72 | port:2:1:+:spam:export | |
|
73 | port:2:2:+:spam:vaportight | |
|
74 | port:2:3:+:spam:import/export | |
|
75 | port:1:2:+:eggs:export | |
|
76 | port:0:1:+:spam:import | |
|
39 | 77 | |
|
40 | cd .. | |
|
41 | hg init t2 | |
|
42 | cd t2 | |
|
43 | hg grep foobar foo | |
|
44 | hg grep foobar | |
|
45 | echo blue >> color | |
|
46 | echo black >> color | |
|
47 | hg add color | |
|
48 | hg ci -m 0 | |
|
49 | echo orange >> color | |
|
50 | hg ci -m 1 | |
|
51 | echo black > color | |
|
52 | hg ci -m 2 | |
|
53 | echo orange >> color | |
|
54 | echo blue >> color | |
|
55 | hg ci -m 3 | |
|
56 | hg grep orange | |
|
57 | hg grep --all orange | |
|
78 | $ cd .. | |
|
79 | $ hg init t2 | |
|
80 | $ cd t2 | |
|
81 | $ hg grep foobar foo | |
|
82 | $ hg grep foobar | |
|
83 | $ echo blue >> color | |
|
84 | $ echo black >> color | |
|
85 | $ hg add color | |
|
86 | $ hg ci -m 0 | |
|
87 | $ echo orange >> color | |
|
88 | $ hg ci -m 1 | |
|
89 | $ echo black > color | |
|
90 | $ hg ci -m 2 | |
|
91 | $ echo orange >> color | |
|
92 | $ echo blue >> color | |
|
93 | $ hg ci -m 3 | |
|
94 | $ hg grep orange | |
|
95 | color:3:orange | |
|
96 | $ hg grep --all orange | |
|
97 | color:3:+:orange | |
|
98 | color:2:-:orange | |
|
99 | color:1:+:orange | |
|
58 | 100 | |
|
59 | echo % match in last "line" without newline | |
|
60 | python -c 'fp = open("noeol", "wb"); fp.write("no infinite loop"); fp.close();' | |
|
61 | hg ci -Amnoeol | |
|
62 | echo % last character omitted in output to avoid infinite loop | |
|
63 | hg grep loop | |
|
101 | ||
|
102 | match in last "line" without newline | |
|
103 | ||
|
104 | $ python -c 'fp = open("noeol", "wb"); fp.write("no infinite loop"); fp.close();' | |
|
105 | $ hg ci -Amnoeol | |
|
106 | adding noeol | |
|
107 | ||
|
108 | last character omitted in output to avoid infinite loop | |
|
109 | ||
|
110 | $ hg grep loop | |
|
111 | noeol:4:no infinite loo | |
|
112 | ||
|
113 | ||
|
114 | $ cd .. | |
|
115 | ||
|
116 | Got a traceback when using grep on a single | |
|
117 | revision with renamed files. | |
|
118 | issue 685 | |
|
64 | 119 | |
|
65 | # Got a traceback when using grep on a single | |
|
66 | # revision with renamed files. | |
|
67 | cd .. | |
|
68 | echo % issue 685 | |
|
69 | hg init issue685 | |
|
70 | cd issue685 | |
|
71 | echo octarine > color | |
|
72 | hg ci -Amcolor | |
|
73 | hg rename color colour | |
|
74 | hg ci -Am rename | |
|
75 | hg grep octarine | |
|
76 |
|
|
|
77 | hg grep -r 1 octarine | |
|
120 | $ hg init issue685 | |
|
121 | $ cd issue685 | |
|
122 | $ echo octarine > color | |
|
123 | $ hg ci -Amcolor | |
|
124 | adding color | |
|
125 | $ hg rename color colour | |
|
126 | $ hg ci -Am rename | |
|
127 | $ hg grep octarine | |
|
128 | colour:1:octarine | |
|
129 | color:0:octarine | |
|
130 | ||
|
131 | Used to crash here | |
|
132 | ||
|
133 | $ hg grep -r 1 octarine | |
|
134 | colour:1:octarine | |
|
135 | $ cd .. | |
|
136 | ||
|
137 | ||
|
138 | Issue337: test that grep follows parent-child relationships instead | |
|
139 | of just using revision numbers. | |
|
78 | 140 | |
|
79 | # Issue337: test that grep follows parent-child relationships instead | |
|
80 | # of just using revision numbers. | |
|
81 | cd .. | |
|
82 | echo % issue 337 | |
|
83 | hg init issue337 | |
|
84 | cd issue337 | |
|
141 | $ hg init issue337 | |
|
142 | $ cd issue337 | |
|
85 | 143 | |
|
86 | echo white > color | |
|
87 | hg commit -A -m "0 white" | |
|
144 | $ echo white > color | |
|
145 | $ hg commit -A -m "0 white" | |
|
146 | adding color | |
|
147 | ||
|
148 | $ echo red > color | |
|
149 | $ hg commit -A -m "1 red" | |
|
88 | 150 | |
|
89 | echo red > color | |
|
90 | hg commit -A -m "1 red" | |
|
151 | $ hg update 0 | |
|
152 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
153 | $ echo black > color | |
|
154 | $ hg commit -A -m "2 black" | |
|
155 | created new head | |
|
91 | 156 | |
|
92 | hg update 0 | |
|
93 | echo black > color | |
|
94 | hg commit -A -m "2 black" | |
|
157 | $ hg update --clean 1 | |
|
158 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
159 | $ echo blue > color | |
|
160 | $ hg commit -A -m "3 blue" | |
|
95 | 161 | |
|
96 | hg update --clean 1 | |
|
97 | echo blue > color | |
|
98 | hg commit -A -m "3 blue" | |
|
99 | ||
|
100 | hg grep --all red | |
|
162 | $ hg grep --all red | |
|
163 | color:3:-:red | |
|
164 | color:1:+:red |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now