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