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