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