| 1 |
$ cat <<EOF >> $HGRCPATH |
| 2 |
> [extensions] |
| 3 |
> mq = |
| 4 |
> [diff] |
| 5 |
> nodates = 1 |
| 6 |
> EOF |
| 7 |
|
| 8 |
$ hg init a |
| 9 |
$ cd a |
| 10 |
|
| 11 |
$ mkdir 1 2 |
| 12 |
$ echo 'base' > 1/base |
| 13 |
$ echo 'base' > 2/base |
| 14 |
$ hg ci -Ambase |
| 15 |
adding 1/base |
| 16 |
adding 2/base |
| 17 |
|
| 18 |
$ hg qnew -mmqbase mqbase |
| 19 |
|
| 20 |
$ echo 'patched' > 1/base |
| 21 |
$ echo 'patched' > 2/base |
| 22 |
$ hg qrefresh |
| 23 |
|
| 24 |
$ hg qdiff |
| 25 |
diff -r e7af5904b465 1/base |
| 26 |
--- a/1/base |
| 27 |
+++ b/1/base |
| 28 |
@@ -1,1 +1,1 @@ |
| 29 |
-base |
| 30 |
+patched |
| 31 |
diff -r e7af5904b465 2/base |
| 32 |
--- a/2/base |
| 33 |
+++ b/2/base |
| 34 |
@@ -1,1 +1,1 @@ |
| 35 |
-base |
| 36 |
+patched |
| 37 |
|
| 38 |
$ hg qdiff . |
| 39 |
diff -r e7af5904b465 1/base |
| 40 |
--- a/1/base |
| 41 |
+++ b/1/base |
| 42 |
@@ -1,1 +1,1 @@ |
| 43 |
-base |
| 44 |
+patched |
| 45 |
diff -r e7af5904b465 2/base |
| 46 |
--- a/2/base |
| 47 |
+++ b/2/base |
| 48 |
@@ -1,1 +1,1 @@ |
| 49 |
-base |
| 50 |
+patched |
| 51 |
|
| 52 |
$ cat .hg/patches/mqbase |
| 53 |
# HG changeset patch |
| 54 |
# Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa |
| 55 |
mqbase |
| 56 |
|
| 57 |
diff -r e7af5904b465 1/base |
| 58 |
--- a/1/base |
| 59 |
+++ b/1/base |
| 60 |
@@ -1,1 +1,1 @@ |
| 61 |
-base |
| 62 |
+patched |
| 63 |
diff -r e7af5904b465 2/base |
| 64 |
--- a/2/base |
| 65 |
+++ b/2/base |
| 66 |
@@ -1,1 +1,1 @@ |
| 67 |
-base |
| 68 |
+patched |
| 69 |
|
| 70 |
$ echo 'patched again' > base |
| 71 |
$ hg qrefresh 1 |
| 72 |
|
| 73 |
$ hg qdiff |
| 74 |
diff -r e7af5904b465 1/base |
| 75 |
--- a/1/base |
| 76 |
+++ b/1/base |
| 77 |
@@ -1,1 +1,1 @@ |
| 78 |
-base |
| 79 |
+patched |
| 80 |
diff -r e7af5904b465 2/base |
| 81 |
--- a/2/base |
| 82 |
+++ b/2/base |
| 83 |
@@ -1,1 +1,1 @@ |
| 84 |
-base |
| 85 |
+patched |
| 86 |
|
| 87 |
$ hg qdiff . |
| 88 |
diff -r e7af5904b465 1/base |
| 89 |
--- a/1/base |
| 90 |
+++ b/1/base |
| 91 |
@@ -1,1 +1,1 @@ |
| 92 |
-base |
| 93 |
+patched |
| 94 |
diff -r e7af5904b465 2/base |
| 95 |
--- a/2/base |
| 96 |
+++ b/2/base |
| 97 |
@@ -1,1 +1,1 @@ |
| 98 |
-base |
| 99 |
+patched |
| 100 |
|
| 101 |
$ cat .hg/patches/mqbase |
| 102 |
# HG changeset patch |
| 103 |
# Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa |
| 104 |
mqbase |
| 105 |
|
| 106 |
diff -r e7af5904b465 1/base |
| 107 |
--- a/1/base |
| 108 |
+++ b/1/base |
| 109 |
@@ -1,1 +1,1 @@ |
| 110 |
-base |
| 111 |
+patched |
| 112 |
|
| 113 |
qrefresh . in subdir: |
| 114 |
|
| 115 |
$ ( cd 1 ; hg qrefresh . ) |
| 116 |
|
| 117 |
$ hg qdiff |
| 118 |
diff -r e7af5904b465 1/base |
| 119 |
--- a/1/base |
| 120 |
+++ b/1/base |
| 121 |
@@ -1,1 +1,1 @@ |
| 122 |
-base |
| 123 |
+patched |
| 124 |
diff -r e7af5904b465 2/base |
| 125 |
--- a/2/base |
| 126 |
+++ b/2/base |
| 127 |
@@ -1,1 +1,1 @@ |
| 128 |
-base |
| 129 |
+patched |
| 130 |
|
| 131 |
$ hg qdiff . |
| 132 |
diff -r e7af5904b465 1/base |
| 133 |
--- a/1/base |
| 134 |
+++ b/1/base |
| 135 |
@@ -1,1 +1,1 @@ |
| 136 |
-base |
| 137 |
+patched |
| 138 |
diff -r e7af5904b465 2/base |
| 139 |
--- a/2/base |
| 140 |
+++ b/2/base |
| 141 |
@@ -1,1 +1,1 @@ |
| 142 |
-base |
| 143 |
+patched |
| 144 |
|
| 145 |
$ cat .hg/patches/mqbase |
| 146 |
# HG changeset patch |
| 147 |
# Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa |
| 148 |
mqbase |
| 149 |
|
| 150 |
diff -r e7af5904b465 1/base |
| 151 |
--- a/1/base |
| 152 |
+++ b/1/base |
| 153 |
@@ -1,1 +1,1 @@ |
| 154 |
-base |
| 155 |
+patched |
| 156 |
|
| 157 |
qrefresh in hg-root again: |
| 158 |
|
| 159 |
$ hg qrefresh |
| 160 |
|
| 161 |
$ hg qdiff |
| 162 |
diff -r e7af5904b465 1/base |
| 163 |
--- a/1/base |
| 164 |
+++ b/1/base |
| 165 |
@@ -1,1 +1,1 @@ |
| 166 |
-base |
| 167 |
+patched |
| 168 |
diff -r e7af5904b465 2/base |
| 169 |
--- a/2/base |
| 170 |
+++ b/2/base |
| 171 |
@@ -1,1 +1,1 @@ |
| 172 |
-base |
| 173 |
+patched |
| 174 |
|
| 175 |
$ hg qdiff . |
| 176 |
diff -r e7af5904b465 1/base |
| 177 |
--- a/1/base |
| 178 |
+++ b/1/base |
| 179 |
@@ -1,1 +1,1 @@ |
| 180 |
-base |
| 181 |
+patched |
| 182 |
diff -r e7af5904b465 2/base |
| 183 |
--- a/2/base |
| 184 |
+++ b/2/base |
| 185 |
@@ -1,1 +1,1 @@ |
| 186 |
-base |
| 187 |
+patched |
| 188 |
|
| 189 |
$ cat .hg/patches/mqbase |
| 190 |
# HG changeset patch |
| 191 |
# Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa |
| 192 |
mqbase |
| 193 |
|
| 194 |
diff -r e7af5904b465 1/base |
| 195 |
--- a/1/base |
| 196 |
+++ b/1/base |
| 197 |
@@ -1,1 +1,1 @@ |
| 198 |
-base |
| 199 |
+patched |
| 200 |
diff -r e7af5904b465 2/base |
| 201 |
--- a/2/base |
| 202 |
+++ b/2/base |
| 203 |
@@ -1,1 +1,1 @@ |
| 204 |
-base |
| 205 |
+patched |
| 206 |
|
| 207 |
|
| 208 |
qrefresh --short tests: |
| 209 |
|
| 210 |
$ echo 'orphan' > orphanchild |
| 211 |
$ hg add orphanchild |
| 212 |
$ hg qrefresh nonexistentfilename # clear patch |
| 213 |
nonexistentfilename: * (glob) |
| 214 |
$ hg diff -c qtip |
| 215 |
$ hg qrefresh --short 1/base |
| 216 |
$ hg qrefresh --short 2/base |
| 217 |
|
| 218 |
$ hg qdiff |
| 219 |
diff -r e7af5904b465 1/base |
| 220 |
--- a/1/base |
| 221 |
+++ b/1/base |
| 222 |
@@ -1,1 +1,1 @@ |
| 223 |
-base |
| 224 |
+patched |
| 225 |
diff -r e7af5904b465 2/base |
| 226 |
--- a/2/base |
| 227 |
+++ b/2/base |
| 228 |
@@ -1,1 +1,1 @@ |
| 229 |
-base |
| 230 |
+patched |
| 231 |
diff -r e7af5904b465 orphanchild |
| 232 |
--- /dev/null |
| 233 |
+++ b/orphanchild |
| 234 |
@@ -0,0 +1,1 @@ |
| 235 |
+orphan |
| 236 |
|
| 237 |
$ cat .hg/patches/mqbase |
| 238 |
# HG changeset patch |
| 239 |
# Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa |
| 240 |
mqbase |
| 241 |
|
| 242 |
diff -r e7af5904b465 1/base |
| 243 |
--- a/1/base |
| 244 |
+++ b/1/base |
| 245 |
@@ -1,1 +1,1 @@ |
| 246 |
-base |
| 247 |
+patched |
| 248 |
diff -r e7af5904b465 2/base |
| 249 |
--- a/2/base |
| 250 |
+++ b/2/base |
| 251 |
@@ -1,1 +1,1 @@ |
| 252 |
-base |
| 253 |
+patched |
| 254 |
|
| 255 |
$ hg st |
| 256 |
A orphanchild |
| 257 |
? base |
| 258 |
|
| 259 |
diff shows what is not in patch: |
| 260 |
|
| 261 |
$ hg diff |
| 262 |
diff -r ???????????? orphanchild (glob) |
| 263 |
--- /dev/null |
| 264 |
+++ b/orphanchild |
| 265 |
@@ -0,0 +1,1 @@ |
| 266 |
+orphan |
| 267 |
|
| 268 |
Before starting exclusive tests: |
| 269 |
|
| 270 |
$ cat .hg/patches/mqbase |
| 271 |
# HG changeset patch |
| 272 |
# Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa |
| 273 |
mqbase |
| 274 |
|
| 275 |
diff -r e7af5904b465 1/base |
| 276 |
--- a/1/base |
| 277 |
+++ b/1/base |
| 278 |
@@ -1,1 +1,1 @@ |
| 279 |
-base |
| 280 |
+patched |
| 281 |
diff -r e7af5904b465 2/base |
| 282 |
--- a/2/base |
| 283 |
+++ b/2/base |
| 284 |
@@ -1,1 +1,1 @@ |
| 285 |
-base |
| 286 |
+patched |
| 287 |
|
| 288 |
Exclude 2/base: |
| 289 |
|
| 290 |
$ hg qref -s -X 2/base |
| 291 |
|
| 292 |
$ cat .hg/patches/mqbase |
| 293 |
# HG changeset patch |
| 294 |
# Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa |
| 295 |
mqbase |
| 296 |
|
| 297 |
diff -r e7af5904b465 1/base |
| 298 |
--- a/1/base |
| 299 |
+++ b/1/base |
| 300 |
@@ -1,1 +1,1 @@ |
| 301 |
-base |
| 302 |
+patched |
| 303 |
|
| 304 |
status shows 2/base as dirty: |
| 305 |
|
| 306 |
$ hg status |
| 307 |
M 2/base |
| 308 |
A orphanchild |
| 309 |
? base |
| 310 |
|
| 311 |
Remove 1/base and add 2/base again but not orphanchild: |
| 312 |
|
| 313 |
$ hg qref -s -X orphanchild -X 1/base 2/base orphanchild |
| 314 |
|
| 315 |
$ cat .hg/patches/mqbase |
| 316 |
# HG changeset patch |
| 317 |
# Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa |
| 318 |
mqbase |
| 319 |
|
| 320 |
diff -r e7af5904b465 2/base |
| 321 |
--- a/2/base |
| 322 |
+++ b/2/base |
| 323 |
@@ -1,1 +1,1 @@ |
| 324 |
-base |
| 325 |
+patched |
| 326 |
|
| 327 |
Add 1/base with include filter - and thus remove 2/base from patch: |
| 328 |
|
| 329 |
$ hg qref -s -I 1/ o* */* |
| 330 |
|
| 331 |
$ cat .hg/patches/mqbase |
| 332 |
# HG changeset patch |
| 333 |
# Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa |
| 334 |
mqbase |
| 335 |
|
| 336 |
diff -r e7af5904b465 1/base |
| 337 |
--- a/1/base |
| 338 |
+++ b/1/base |
| 339 |
@@ -1,1 +1,1 @@ |
| 340 |
-base |
| 341 |
+patched |
| 342 |
|
| 343 |
$ cd .. |
| 344 |
|
| 345 |
|
| 346 |
Test qrefresh --git losing copy metadata: |
| 347 |
|
| 348 |
$ hg init repo |
| 349 |
$ cd repo |
| 350 |
|
| 351 |
$ echo "[diff]" >> .hg/hgrc |
| 352 |
$ echo "git=True" >> .hg/hgrc |
| 353 |
$ echo a > a |
| 354 |
|
| 355 |
$ hg ci -Am adda |
| 356 |
adding a |
| 357 |
$ hg copy a ab |
| 358 |
$ echo b >> ab |
| 359 |
$ hg copy a ac |
| 360 |
$ echo c >> ac |
| 361 |
|
| 362 |
Capture changes: |
| 363 |
|
| 364 |
$ hg qnew -f p1 |
| 365 |
|
| 366 |
$ hg qdiff |
| 367 |
diff --git a/a b/ab |
| 368 |
copy from a |
| 369 |
copy to ab |
| 370 |
--- a/a |
| 371 |
+++ b/ab |
| 372 |
@@ -1,1 +1,2 @@ |
| 373 |
a |
| 374 |
+b |
| 375 |
diff --git a/a b/ac |
| 376 |
copy from a |
| 377 |
copy to ac |
| 378 |
--- a/a |
| 379 |
+++ b/ac |
| 380 |
@@ -1,1 +1,2 @@ |
| 381 |
a |
| 382 |
+c |
| 383 |
|
| 384 |
Refresh and check changes again: |
| 385 |
|
| 386 |
$ hg qrefresh |
| 387 |
|
| 388 |
$ hg qdiff |
| 389 |
diff --git a/a b/ab |
| 390 |
copy from a |
| 391 |
copy to ab |
| 392 |
--- a/a |
| 393 |
+++ b/ab |
| 394 |
@@ -1,1 +1,2 @@ |
| 395 |
a |
| 396 |
+b |
| 397 |
diff --git a/a b/ac |
| 398 |
copy from a |
| 399 |
copy to ac |
| 400 |
--- a/a |
| 401 |
+++ b/ac |
| 402 |
@@ -1,1 +1,2 @@ |
| 403 |
a |
| 404 |
+c |
| 405 |
|
| 406 |
$ cd .. |
| 407 |
|
| 408 |
|
| 409 |
Issue1441: qrefresh confused after hg rename: |
| 410 |
|
| 411 |
$ hg init repo-1441 |
| 412 |
$ cd repo-1441 |
| 413 |
$ echo a > a |
| 414 |
$ hg add a |
| 415 |
$ hg qnew -f p |
| 416 |
$ hg mv a b |
| 417 |
$ hg qrefresh |
| 418 |
|
| 419 |
$ hg qdiff |
| 420 |
diff -r 000000000000 b |
| 421 |
--- /dev/null |
| 422 |
+++ b/b |
| 423 |
@@ -0,0 +1,1 @@ |
| 424 |
+a |
| 425 |
|
| 426 |
$ cd .. |
| 427 |
|
| 428 |
|
| 429 |
Issue2025: qrefresh does not honor filtering options when tip != |
| 430 |
qtip: |
| 431 |
|
| 432 |
$ hg init repo-2025 |
| 433 |
$ cd repo-2025 |
| 434 |
$ echo a > a |
| 435 |
$ echo b > b |
| 436 |
$ hg ci -qAm addab |
| 437 |
$ echo a >> a |
| 438 |
$ echo b >> b |
| 439 |
$ hg qnew -f patch |
| 440 |
$ hg up -qC 0 |
| 441 |
$ echo c > c |
| 442 |
$ hg ci -qAm addc |
| 443 |
$ hg up -qC 1 |
| 444 |
|
| 445 |
refresh with tip != qtip: |
| 446 |
|
| 447 |
$ hg --config diff.nodates=1 qrefresh -I b |
| 448 |
|
| 449 |
$ hg st |
| 450 |
M a |
| 451 |
|
| 452 |
$ cat b |
| 453 |
b |
| 454 |
b |
| 455 |
|
| 456 |
$ cat .hg/patches/patch |
| 457 |
# HG changeset patch |
| 458 |
# Parent 1a60229be7ac3e4a7f647508e99b87bef1f03593 |
| 459 |
|
| 460 |
diff -r 1a60229be7ac b |
| 461 |
--- a/b |
| 462 |
+++ b/b |
| 463 |
@@ -1,1 +1,2 @@ |
| 464 |
b |
| 465 |
+b |
| 466 |
|
| 467 |
$ cd .. |
| 468 |
|
| 469 |
|
| 470 |
Issue1441 with git patches: |
| 471 |
|
| 472 |
$ hg init repo-1441-git |
| 473 |
$ cd repo-1441-git |
| 474 |
|
| 475 |
$ echo "[diff]" >> .hg/hgrc |
| 476 |
$ echo "git=True" >> .hg/hgrc |
| 477 |
|
| 478 |
$ echo a > a |
| 479 |
$ hg add a |
| 480 |
$ hg qnew -f p |
| 481 |
$ hg mv a b |
| 482 |
$ hg qrefresh |
| 483 |
|
| 484 |
$ hg qdiff --nodates |
| 485 |
diff --git a/b b/b |
| 486 |
new file mode 100644 |
| 487 |
--- /dev/null |
| 488 |
+++ b/b |
| 489 |
@@ -0,0 +1,1 @@ |
| 490 |
+a |
| 491 |
|
| 492 |
$ cd .. |
| 493 |
|
| 494 |
Refresh with bad usernames. Mercurial used to abort on bad usernames, |
| 495 |
but only after writing the bad name into the patch. |
| 496 |
|
| 497 |
$ hg init bad-usernames |
| 498 |
$ cd bad-usernames |
| 499 |
$ touch a |
| 500 |
$ hg add a |
| 501 |
$ hg qnew a |
| 502 |
$ hg qrefresh -u 'foo |
| 503 |
> bar' |
| 504 |
transaction abort! |
| 505 |
rollback completed |
| 506 |
qrefresh interrupted while patch was popped! (revert --all, qpush to recover) |
| 507 |
abort: username 'foo\nbar' contains a newline |
| 508 |
[50] |
| 509 |
$ rm a |
| 510 |
$ cat .hg/patches/a |
| 511 |
# HG changeset patch |
| 512 |
# Parent 0000000000000000000000000000000000000000 |
| 513 |
|
| 514 |
diff --git a/a b/a |
| 515 |
new file mode 100644 |
| 516 |
$ hg qpush |
| 517 |
applying a |
| 518 |
now at: a |
| 519 |
$ hg qrefresh -u ' ' |
| 520 |
transaction abort! |
| 521 |
rollback completed |
| 522 |
qrefresh interrupted while patch was popped! (revert --all, qpush to recover) |
| 523 |
abort: empty username |
| 524 |
[50] |
| 525 |
$ cat .hg/patches/a |
| 526 |
# HG changeset patch |
| 527 |
# Parent 0000000000000000000000000000000000000000 |
| 528 |
|
| 529 |
diff --git a/a b/a |
| 530 |
new file mode 100644 |
| 531 |
$ cd .. |
| 532 |
|
| 533 |
Refresh with phase data: |
| 534 |
|
| 535 |
|
| 536 |
|
| 537 |
$ cd repo |
| 538 |
$ echo 'babar' >> a |
| 539 |
$ hg qnew -m 'update a' p2.diff |
| 540 |
$ hg phase p2.diff |
| 541 |
2: draft |
| 542 |
$ echo 'beber' >> a |
| 543 |
$ hg qref |
| 544 |
$ hg phase p2.diff |
| 545 |
2: draft |
| 546 |
$ hg phase --force --secret p2.diff |
| 547 |
$ echo 'bibir' >> a |
| 548 |
$ hg qref |
| 549 |
$ hg phase p2.diff |
| 550 |
2: secret |
| 551 |
|
| 552 |
$ cd .. |