##// END OF EJS Templates
tests: exercise some corner cases for mq guard selection and --reapply
Mads Kiilerich -
r15245:aa2c3505 default
parent child Browse files
Show More
@@ -1,436 +1,504 b''
1 1 $ echo "[extensions]" >> $HGRCPATH
2 2 $ echo "mq=" >> $HGRCPATH
3 3
4 4 $ hg init
5 5 $ hg qinit
6 6
7 7 $ echo x > x
8 8 $ hg ci -Ama
9 9 adding x
10 10
11 11 $ hg qnew a.patch
12 12 $ echo a > a
13 13 $ hg add a
14 14 $ hg qrefresh
15 15
16 16 $ hg qnew b.patch
17 17 $ echo b > b
18 18 $ hg add b
19 19 $ hg qrefresh
20 20
21 21 $ hg qnew c.patch
22 22 $ echo c > c
23 23 $ hg add c
24 24 $ hg qrefresh
25 25
26 26 $ hg qpop -a
27 27 popping c.patch
28 28 popping b.patch
29 29 popping a.patch
30 30 patch queue now empty
31 31
32 32
33 33 should fail
34 34
35 35 $ hg qguard does-not-exist.patch +bleh
36 36 abort: no patch named does-not-exist.patch
37 37 [255]
38 38
39 39
40 40 should fail
41 41
42 42 $ hg qguard +fail
43 43 abort: no patches applied
44 44 [255]
45 45
46 46 $ hg qpush
47 47 applying a.patch
48 48 now at: a.patch
49 49
50 50 should guard a.patch
51 51
52 52 $ hg qguard +a
53 53
54 54 should print +a
55 55
56 56 $ hg qguard
57 57 a.patch: +a
58 58 $ hg qpop
59 59 popping a.patch
60 60 patch queue now empty
61 61
62 62
63 63 should fail
64 64
65 65 $ hg qpush a.patch
66 66 cannot push 'a.patch' - guarded by '+a'
67 67 [1]
68 68
69 69 $ hg qguard a.patch
70 70 a.patch: +a
71 71
72 72 should push b.patch
73 73
74 74 $ hg qpush
75 75 applying b.patch
76 76 now at: b.patch
77 77
78 78 $ hg qpop
79 79 popping b.patch
80 80 patch queue now empty
81 81
82 82 test selection of an empty guard
83 83
84 84 $ hg qselect ""
85 85 abort: guard cannot be an empty string
86 86 [255]
87 87 $ hg qselect a
88 88 number of unguarded, unapplied patches has changed from 2 to 3
89 89
90 90 should push a.patch
91 91
92 92 $ hg qpush
93 93 applying a.patch
94 94 now at: a.patch
95 95
96 96 $ hg qguard -- c.patch -a
97 97
98 98 should print -a
99 99
100 100 $ hg qguard c.patch
101 101 c.patch: -a
102 102
103 103
104 104 should skip c.patch
105 105
106 106 $ hg qpush -a
107 107 applying b.patch
108 108 skipping c.patch - guarded by '-a'
109 109 now at: b.patch
110 110
111 111 should display b.patch
112 112
113 113 $ hg qtop
114 114 b.patch
115 115
116 116 $ hg qguard -n c.patch
117 117
118 118 should push c.patch
119 119
120 120 $ hg qpush -a
121 121 applying c.patch
122 122 now at: c.patch
123 123
124 124 $ hg qpop -a
125 125 popping c.patch
126 126 popping b.patch
127 127 popping a.patch
128 128 patch queue now empty
129 129 $ hg qselect -n
130 130 guards deactivated
131 131 number of unguarded, unapplied patches has changed from 3 to 2
132 132
133 133 should push all
134 134
135 135 $ hg qpush -a
136 136 applying b.patch
137 137 applying c.patch
138 138 now at: c.patch
139 139
140 140 $ hg qpop -a
141 141 popping c.patch
142 142 popping b.patch
143 143 patch queue now empty
144 144 $ hg qguard a.patch +1
145 145 $ hg qguard b.patch +2
146 146 $ hg qselect 1
147 147 number of unguarded, unapplied patches has changed from 1 to 2
148 148
149 149 should push a.patch, not b.patch
150 150
151 151 $ hg qpush
152 152 applying a.patch
153 153 now at: a.patch
154 154 $ hg qpush
155 155 applying c.patch
156 156 now at: c.patch
157 157 $ hg qpop -a
158 158 popping c.patch
159 159 popping a.patch
160 160 patch queue now empty
161 161
162 162 $ hg qselect 2
163 163
164 164 should push b.patch
165 165
166 166 $ hg qpush
167 167 applying b.patch
168 168 now at: b.patch
169 169 $ hg qpush -a
170 170 applying c.patch
171 171 now at: c.patch
172 172
173 173 Used to be an issue with holes in the patch sequence
174 174 So, put one hole on the base and ask for topmost patch.
175 175
176 176 $ hg qtop
177 177 c.patch
178 178 $ hg qpop -a
179 179 popping c.patch
180 180 popping b.patch
181 181 patch queue now empty
182 182
183 183 $ hg qselect 1 2
184 184 number of unguarded, unapplied patches has changed from 2 to 3
185 185
186 186 should push a.patch, b.patch
187 187
188 188 $ hg qpush
189 189 applying a.patch
190 190 now at: a.patch
191 191 $ hg qpush
192 192 applying b.patch
193 193 now at: b.patch
194 194 $ hg qpop -a
195 195 popping b.patch
196 196 popping a.patch
197 197 patch queue now empty
198 198
199 199 $ hg qguard -- a.patch +1 +2 -3
200 200 $ hg qselect 1 2 3
201 201 number of unguarded, unapplied patches has changed from 3 to 2
202 202
203 203
204 204 list patches and guards
205 205
206 206 $ hg qguard -l
207 207 a.patch: +1 +2 -3
208 208 b.patch: +2
209 209 c.patch: unguarded
210 210
211 211 have at least one patch applied to test coloring
212 212
213 213 $ hg qpush
214 214 applying b.patch
215 215 now at: b.patch
216 216
217 217 list patches and guards with color
218 218
219 219 $ hg --config extensions.color= qguard --config color.mode=ansi \
220 220 > -l --color=always
221 221 \x1b[0;30;1ma.patch\x1b[0m: \x1b[0;33m+1\x1b[0m \x1b[0;33m+2\x1b[0m \x1b[0;31m-3\x1b[0m (esc)
222 222 \x1b[0;34;1;4mb.patch\x1b[0m: \x1b[0;33m+2\x1b[0m (esc)
223 223 \x1b[0;30;1mc.patch\x1b[0m: \x1b[0;32munguarded\x1b[0m (esc)
224 224
225 225 should pop b.patch
226 226
227 227 $ hg qpop
228 228 popping b.patch
229 229 patch queue now empty
230 230
231 231 list series
232 232
233 233 $ hg qseries -v
234 234 0 G a.patch
235 235 1 U b.patch
236 236 2 U c.patch
237 237
238 238 list guards
239 239
240 240 $ hg qselect
241 241 1
242 242 2
243 243 3
244 244
245 245 should push b.patch
246 246
247 247 $ hg qpush
248 248 applying b.patch
249 249 now at: b.patch
250 250
251 251 $ hg qpush -a
252 252 applying c.patch
253 253 now at: c.patch
254 254 $ hg qselect -n --reapply
255 255 guards deactivated
256 256 popping guarded patches
257 257 popping c.patch
258 258 popping b.patch
259 259 patch queue now empty
260 260 reapplying unguarded patches
261 261 applying c.patch
262 262 now at: c.patch
263 263
264 264 guards in series file: +1 +2 -3
265 265
266 266 $ hg qselect -s
267 267 +1
268 268 +2
269 269 -3
270 270
271 271 should show c.patch
272 272
273 273 $ hg qapplied
274 274 c.patch
275 275
276 276 $ hg qrename a.patch new.patch
277 277
278 278 should show :
279 279
280 280
281 281 new.patch: +1 +2 -3
282 282
283 283
284 284 b.patch: +2
285 285
286 286
287 287 c.patch: unguarded
288 288
289 289 $ hg qguard -l
290 290 new.patch: +1 +2 -3
291 291 b.patch: +2
292 292 c.patch: unguarded
293 293
294 294 $ hg qnew d.patch
295 295 $ hg qpop
296 296 popping d.patch
297 297 now at: c.patch
298 298
299 299 should show new.patch and b.patch as Guarded, c.patch as Applied
300 300
301 301
302 302 and d.patch as Unapplied
303 303
304 304 $ hg qseries -v
305 305 0 G new.patch
306 306 1 G b.patch
307 307 2 A c.patch
308 308 3 U d.patch
309 309
310 310 qseries again, but with color
311 311
312 312 $ hg --config extensions.color= --config color.mode=ansi qseries -v --color=always
313 313 0 G \x1b[0;30;1mnew.patch\x1b[0m (esc)
314 314 1 G \x1b[0;30;1mb.patch\x1b[0m (esc)
315 315 2 A \x1b[0;34;1;4mc.patch\x1b[0m (esc)
316 316 3 U \x1b[0;30;1md.patch\x1b[0m (esc)
317 317
318 318 $ hg qguard d.patch +2
319 319
320 320 new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded.
321 321
322 322 $ hg qseries -v
323 323 0 G new.patch
324 324 1 G b.patch
325 325 2 A c.patch
326 326 3 G d.patch
327 327
328 328 $ qappunappv()
329 329 > {
330 330 > for command in qapplied "qapplied -v" qunapplied "qunapplied -v"; do
331 331 > echo % hg $command
332 332 > hg $command
333 333 > done
334 334 > }
335 335
336 336 $ hg qpop -a
337 337 popping c.patch
338 338 patch queue now empty
339 339 $ hg qguard -l
340 340 new.patch: +1 +2 -3
341 341 b.patch: +2
342 342 c.patch: unguarded
343 343 d.patch: +2
344 344 $ qappunappv
345 345 % hg qapplied
346 346 % hg qapplied -v
347 347 % hg qunapplied
348 348 c.patch
349 349 % hg qunapplied -v
350 350 0 G new.patch
351 351 1 G b.patch
352 352 2 U c.patch
353 353 3 G d.patch
354 354 $ hg qselect 1
355 355 number of unguarded, unapplied patches has changed from 1 to 2
356 356 $ qappunappv
357 357 % hg qapplied
358 358 % hg qapplied -v
359 359 % hg qunapplied
360 360 new.patch
361 361 c.patch
362 362 % hg qunapplied -v
363 363 0 U new.patch
364 364 1 G b.patch
365 365 2 U c.patch
366 366 3 G d.patch
367 367 $ hg qpush -a
368 368 applying new.patch
369 369 skipping b.patch - guarded by '+2'
370 370 applying c.patch
371 371 skipping d.patch - guarded by '+2'
372 372 now at: c.patch
373 373 $ qappunappv
374 374 % hg qapplied
375 375 new.patch
376 376 c.patch
377 377 % hg qapplied -v
378 378 0 A new.patch
379 379 1 G b.patch
380 380 2 A c.patch
381 381 % hg qunapplied
382 382 % hg qunapplied -v
383 383 3 G d.patch
384 384 $ hg qselect 2
385 385 number of unguarded, unapplied patches has changed from 0 to 1
386 386 number of guarded, applied patches has changed from 1 to 0
387 387 $ qappunappv
388 388 % hg qapplied
389 389 new.patch
390 390 c.patch
391 391 % hg qapplied -v
392 392 0 A new.patch
393 393 1 U b.patch
394 394 2 A c.patch
395 395 % hg qunapplied
396 396 d.patch
397 397 % hg qunapplied -v
398 398 3 U d.patch
399 399
400 400 $ for patch in `hg qseries`; do
401 401 > echo % hg qapplied $patch
402 402 > hg qapplied $patch
403 403 > echo % hg qunapplied $patch
404 404 > hg qunapplied $patch
405 405 > done
406 406 % hg qapplied new.patch
407 407 new.patch
408 408 % hg qunapplied new.patch
409 409 b.patch
410 410 d.patch
411 411 % hg qapplied b.patch
412 412 new.patch
413 413 % hg qunapplied b.patch
414 414 d.patch
415 415 % hg qapplied c.patch
416 416 new.patch
417 417 c.patch
418 418 % hg qunapplied c.patch
419 419 d.patch
420 420 % hg qapplied d.patch
421 421 new.patch
422 422 c.patch
423 423 % hg qunapplied d.patch
424 424
425 425
426 426 hg qseries -m: only b.patch should be shown
427 427 the guards file was not ignored in the past
428 428
429 429 $ hg qdelete -k b.patch
430 430 $ hg qseries -m
431 431 b.patch
432 432
433 433 hg qseries -m with color
434 434
435 435 $ hg --config extensions.color= --config color.mode=ansi qseries -m --color=always
436 436 \x1b[0;31;1mb.patch\x1b[0m (esc)
437
438
439 excercise cornercases in "qselect --reapply"
440
441 $ hg qpop -a
442 popping c.patch
443 popping new.patch
444 patch queue now empty
445 $ hg qguard -- new.patch -not-new
446 $ hg qguard -- c.patch -not-c
447 $ hg qguard -- d.patch -not-d
448 $ hg qpush -a
449 applying new.patch
450 applying c.patch
451 applying d.patch
452 patch d.patch is empty
453 now at: d.patch
454 $ hg qguard -l
455 new.patch: -not-new
456 c.patch: -not-c
457 d.patch: -not-d
458 $ hg qselect --reapply not-d
459 popping guarded patches
460 popping d.patch
461 now at: c.patch
462 reapplying unguarded patches
463 cannot push 'd.patch' - guarded by '-not-d'
464 $ hg qser -v
465 0 A new.patch
466 1 A c.patch
467 2 G d.patch
468 $ hg qselect --reapply -n
469 guards deactivated
470 $ hg qpush
471 applying d.patch
472 patch d.patch is empty
473 now at: d.patch
474 $ hg qser -v
475 0 A new.patch
476 1 A c.patch
477 2 A d.patch
478 $ hg qselect --reapply not-c
479 popping guarded patches
480 popping d.patch
481 now at: c.patch
482 reapplying unguarded patches
483 applying d.patch
484 patch d.patch is empty
485 now at: d.patch
486 $ hg qser -v
487 0 A new.patch
488 1 A c.patch
489 2 A d.patch
490 $ hg qselect --reapply not-new
491 popping guarded patches
492 popping d.patch
493 popping c.patch
494 popping new.patch
495 patch queue now empty
496 reapplying unguarded patches
497 applying c.patch
498 applying d.patch
499 patch d.patch is empty
500 now at: d.patch
501 $ hg qser -v
502 0 G new.patch
503 1 A c.patch
504 2 A d.patch
General Comments 0
You need to be logged in to leave comments. Login now