##// END OF EJS Templates
test-status-color: fix terminfo code compatibility problem...
Patrick Mezard -
r13997:b083d005 default
parent child Browse files
Show More
@@ -1,292 +1,294 b''
1 1 $ echo "[extensions]" >> $HGRCPATH
2 2 $ echo "color=" >> $HGRCPATH
3 3 $ echo "[color]" >> $HGRCPATH
4 4 $ echo "mode=ansi" >> $HGRCPATH
5 Terminfo codes compatibility fix
6 $ echo "color.none=0" >> $HGRCPATH
5 7
6 8 $ hg init repo1
7 9 $ cd repo1
8 10 $ mkdir a b a/1 b/1 b/2
9 11 $ touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2
10 12
11 13 hg status in repo root:
12 14
13 15 $ hg status --color=always
14 16 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
15 17 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
16 18 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
17 19 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
18 20 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
19 21 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
20 22
21 23 hg status . in repo root:
22 24
23 25 $ hg status --color=always .
24 26 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
25 27 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
26 28 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
27 29 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
28 30 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
29 31 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
30 32
31 33 $ hg status --color=always --cwd a
32 34 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
33 35 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
34 36 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
35 37 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
36 38 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
37 39 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
38 40 $ hg status --color=always --cwd a .
39 41 \x1b[0;35;1;4m? 1/in_a_1\x1b[0m (esc)
40 42 \x1b[0;35;1;4m? in_a\x1b[0m (esc)
41 43 $ hg status --color=always --cwd a ..
42 44 \x1b[0;35;1;4m? 1/in_a_1\x1b[0m (esc)
43 45 \x1b[0;35;1;4m? in_a\x1b[0m (esc)
44 46 \x1b[0;35;1;4m? ../b/1/in_b_1\x1b[0m (esc)
45 47 \x1b[0;35;1;4m? ../b/2/in_b_2\x1b[0m (esc)
46 48 \x1b[0;35;1;4m? ../b/in_b\x1b[0m (esc)
47 49 \x1b[0;35;1;4m? ../in_root\x1b[0m (esc)
48 50
49 51 $ hg status --color=always --cwd b
50 52 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
51 53 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
52 54 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
53 55 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
54 56 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
55 57 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
56 58 $ hg status --color=always --cwd b .
57 59 \x1b[0;35;1;4m? 1/in_b_1\x1b[0m (esc)
58 60 \x1b[0;35;1;4m? 2/in_b_2\x1b[0m (esc)
59 61 \x1b[0;35;1;4m? in_b\x1b[0m (esc)
60 62 $ hg status --color=always --cwd b ..
61 63 \x1b[0;35;1;4m? ../a/1/in_a_1\x1b[0m (esc)
62 64 \x1b[0;35;1;4m? ../a/in_a\x1b[0m (esc)
63 65 \x1b[0;35;1;4m? 1/in_b_1\x1b[0m (esc)
64 66 \x1b[0;35;1;4m? 2/in_b_2\x1b[0m (esc)
65 67 \x1b[0;35;1;4m? in_b\x1b[0m (esc)
66 68 \x1b[0;35;1;4m? ../in_root\x1b[0m (esc)
67 69
68 70 $ hg status --color=always --cwd a/1
69 71 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
70 72 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
71 73 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
72 74 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
73 75 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
74 76 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
75 77 $ hg status --color=always --cwd a/1 .
76 78 \x1b[0;35;1;4m? in_a_1\x1b[0m (esc)
77 79 $ hg status --color=always --cwd a/1 ..
78 80 \x1b[0;35;1;4m? in_a_1\x1b[0m (esc)
79 81 \x1b[0;35;1;4m? ../in_a\x1b[0m (esc)
80 82
81 83 $ hg status --color=always --cwd b/1
82 84 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
83 85 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
84 86 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
85 87 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
86 88 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
87 89 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
88 90 $ hg status --color=always --cwd b/1 .
89 91 \x1b[0;35;1;4m? in_b_1\x1b[0m (esc)
90 92 $ hg status --color=always --cwd b/1 ..
91 93 \x1b[0;35;1;4m? in_b_1\x1b[0m (esc)
92 94 \x1b[0;35;1;4m? ../2/in_b_2\x1b[0m (esc)
93 95 \x1b[0;35;1;4m? ../in_b\x1b[0m (esc)
94 96
95 97 $ hg status --color=always --cwd b/2
96 98 \x1b[0;35;1;4m? a/1/in_a_1\x1b[0m (esc)
97 99 \x1b[0;35;1;4m? a/in_a\x1b[0m (esc)
98 100 \x1b[0;35;1;4m? b/1/in_b_1\x1b[0m (esc)
99 101 \x1b[0;35;1;4m? b/2/in_b_2\x1b[0m (esc)
100 102 \x1b[0;35;1;4m? b/in_b\x1b[0m (esc)
101 103 \x1b[0;35;1;4m? in_root\x1b[0m (esc)
102 104 $ hg status --color=always --cwd b/2 .
103 105 \x1b[0;35;1;4m? in_b_2\x1b[0m (esc)
104 106 $ hg status --color=always --cwd b/2 ..
105 107 \x1b[0;35;1;4m? ../1/in_b_1\x1b[0m (esc)
106 108 \x1b[0;35;1;4m? in_b_2\x1b[0m (esc)
107 109 \x1b[0;35;1;4m? ../in_b\x1b[0m (esc)
108 110 $ cd ..
109 111
110 112 $ hg init repo2
111 113 $ cd repo2
112 114 $ touch modified removed deleted ignored
113 115 $ echo "^ignored$" > .hgignore
114 116 $ hg ci -A -m 'initial checkin'
115 117 adding .hgignore
116 118 adding deleted
117 119 adding modified
118 120 adding removed
119 121 $ touch modified added unknown ignored
120 122 $ hg add added
121 123 $ hg remove removed
122 124 $ rm deleted
123 125
124 126 hg status:
125 127
126 128 $ hg status --color=always
127 129 \x1b[0;32;1mA added\x1b[0m (esc)
128 130 \x1b[0;31;1mR removed\x1b[0m (esc)
129 131 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
130 132 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
131 133
132 134 hg status modified added removed deleted unknown never-existed ignored:
133 135
134 136 $ hg status --color=always modified added removed deleted unknown never-existed ignored
135 137 never-existed: No such file or directory
136 138 \x1b[0;32;1mA added\x1b[0m (esc)
137 139 \x1b[0;31;1mR removed\x1b[0m (esc)
138 140 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
139 141 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
140 142
141 143 $ hg copy modified copied
142 144
143 145 hg status -C:
144 146
145 147 $ hg status --color=always -C
146 148 \x1b[0;32;1mA added\x1b[0m (esc)
147 149 \x1b[0;32;1mA copied\x1b[0m (esc)
148 150 \x1b[0;0m modified\x1b[0m (esc)
149 151 \x1b[0;31;1mR removed\x1b[0m (esc)
150 152 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
151 153 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
152 154
153 155 hg status -A:
154 156
155 157 $ hg status --color=always -A
156 158 \x1b[0;32;1mA added\x1b[0m (esc)
157 159 \x1b[0;32;1mA copied\x1b[0m (esc)
158 160 \x1b[0;0m modified\x1b[0m (esc)
159 161 \x1b[0;31;1mR removed\x1b[0m (esc)
160 162 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
161 163 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
162 164 \x1b[0;30;1mI ignored\x1b[0m (esc)
163 165 \x1b[0;0mC .hgignore\x1b[0m (esc)
164 166 \x1b[0;0mC modified\x1b[0m (esc)
165 167
166 168 hg status -A (with terminfo color):
167 169
168 170 $ TERM=xterm hg status --config color.mode=terminfo --color=always -A
169 \x1b(B\x1b[m\x1b[32m\x1b[1mA added\x1b(B\x1b[m (esc)
170 \x1b(B\x1b[m\x1b[32m\x1b[1mA copied\x1b(B\x1b[m (esc)
171 \x1b(B\x1b[m\x1b(B\x1b[m modified\x1b(B\x1b[m (esc)
172 \x1b(B\x1b[m\x1b[31m\x1b[1mR removed\x1b(B\x1b[m (esc)
173 \x1b(B\x1b[m\x1b[36m\x1b[1m\x1b[4m! deleted\x1b(B\x1b[m (esc)
174 \x1b(B\x1b[m\x1b[35m\x1b[1m\x1b[4m? unknown\x1b(B\x1b[m (esc)
175 \x1b(B\x1b[m\x1b[30m\x1b[1mI ignored\x1b(B\x1b[m (esc)
176 \x1b(B\x1b[m\x1b(B\x1b[mC .hgignore\x1b(B\x1b[m (esc)
177 \x1b(B\x1b[m\x1b(B\x1b[mC modified\x1b(B\x1b[m (esc)
171 \x1b[30m\x1b[32m\x1b[1mA added\x1b[30m (esc)
172 \x1b[30m\x1b[32m\x1b[1mA copied\x1b[30m (esc)
173 \x1b[30m\x1b[30m modified\x1b[30m (esc)
174 \x1b[30m\x1b[31m\x1b[1mR removed\x1b[30m (esc)
175 \x1b[30m\x1b[36m\x1b[1m\x1b[4m! deleted\x1b[30m (esc)
176 \x1b[30m\x1b[35m\x1b[1m\x1b[4m? unknown\x1b[30m (esc)
177 \x1b[30m\x1b[30m\x1b[1mI ignored\x1b[30m (esc)
178 \x1b[30m\x1b[30mC .hgignore\x1b[30m (esc)
179 \x1b[30m\x1b[30mC modified\x1b[30m (esc)
178 180
179 181
180 182 $ echo "^ignoreddir$" > .hgignore
181 183 $ mkdir ignoreddir
182 184 $ touch ignoreddir/file
183 185
184 186 hg status ignoreddir/file:
185 187
186 188 $ hg status --color=always ignoreddir/file
187 189
188 190 hg status -i ignoreddir/file:
189 191
190 192 $ hg status --color=always -i ignoreddir/file
191 193 \x1b[0;30;1mI ignoreddir/file\x1b[0m (esc)
192 194 $ cd ..
193 195
194 196 check 'status -q' and some combinations
195 197
196 198 $ hg init repo3
197 199 $ cd repo3
198 200 $ touch modified removed deleted ignored
199 201 $ echo "^ignored$" > .hgignore
200 202 $ hg commit -A -m 'initial checkin'
201 203 adding .hgignore
202 204 adding deleted
203 205 adding modified
204 206 adding removed
205 207 $ touch added unknown ignored
206 208 $ hg add added
207 209 $ echo "test" >> modified
208 210 $ hg remove removed
209 211 $ rm deleted
210 212 $ hg copy modified copied
211 213
212 214 test unknown color
213 215
214 216 $ hg --config color.status.modified=periwinkle status --color=always
215 217 ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
216 218 M modified
217 219 \x1b[0;32;1mA added\x1b[0m (esc)
218 220 \x1b[0;32;1mA copied\x1b[0m (esc)
219 221 \x1b[0;31;1mR removed\x1b[0m (esc)
220 222 \x1b[0;36;1;4m! deleted\x1b[0m (esc)
221 223 \x1b[0;35;1;4m? unknown\x1b[0m (esc)
222 224
223 225 Run status with 2 different flags.
224 226 Check if result is the same or different.
225 227 If result is not as expected, raise error
226 228
227 229 $ assert() {
228 230 > hg status --color=always $1 > ../a
229 231 > hg status --color=always $2 > ../b
230 232 > if diff ../a ../b > /dev/null; then
231 233 > out=0
232 234 > else
233 235 > out=1
234 236 > fi
235 237 > if [ $3 -eq 0 ]; then
236 238 > df="same"
237 239 > else
238 240 > df="different"
239 241 > fi
240 242 > if [ $out -ne $3 ]; then
241 243 > echo "Error on $1 and $2, should be $df."
242 244 > fi
243 245 > }
244 246
245 247 assert flag1 flag2 [0-same | 1-different]
246 248
247 249 $ assert "-q" "-mard" 0
248 250 $ assert "-A" "-marduicC" 0
249 251 $ assert "-qA" "-mardcC" 0
250 252 $ assert "-qAui" "-A" 0
251 253 $ assert "-qAu" "-marducC" 0
252 254 $ assert "-qAi" "-mardicC" 0
253 255 $ assert "-qu" "-u" 0
254 256 $ assert "-q" "-u" 1
255 257 $ assert "-m" "-a" 1
256 258 $ assert "-r" "-d" 1
257 259 $ cd ..
258 260
259 261 test 'resolve -l'
260 262
261 263 $ hg init repo4
262 264 $ cd repo4
263 265 $ echo "file a" > a
264 266 $ echo "file b" > b
265 267 $ hg add a b
266 268 $ hg commit -m "initial"
267 269 $ echo "file a change 1" > a
268 270 $ echo "file b change 1" > b
269 271 $ hg commit -m "head 1"
270 272 $ hg update 0
271 273 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
272 274 $ echo "file a change 2" > a
273 275 $ echo "file b change 2" > b
274 276 $ hg commit -m "head 2"
275 277 created new head
276 278 $ hg merge
277 279 merging a
278 280 warning: conflicts during merge.
279 281 merging a failed!
280 282 merging b
281 283 warning: conflicts during merge.
282 284 merging b failed!
283 285 0 files updated, 0 files merged, 0 files removed, 2 files unresolved
284 286 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
285 287 [1]
286 288 $ hg resolve -m b
287 289
288 290 hg resolve with one unresolved, one resolved:
289 291
290 292 $ hg resolve --color=always -l
291 293 \x1b[0;31;1mU a\x1b[0m (esc)
292 294 \x1b[0;32;1mR b\x1b[0m (esc)
General Comments 0
You need to be logged in to leave comments. Login now