| 1 |
#testcases filelog compatibility changeset sidedata |
| 2 |
|
| 3 |
$ cat >> $HGRCPATH << EOF |
| 4 |
> [extensions] |
| 5 |
> rebase= |
| 6 |
> [alias] |
| 7 |
> l = log -G -T '{rev} {desc}\n{files}\n' |
| 8 |
> EOF |
| 9 |
|
| 10 |
#if compatibility |
| 11 |
$ cat >> $HGRCPATH << EOF |
| 12 |
> [experimental] |
| 13 |
> copies.read-from = compatibility |
| 14 |
> EOF |
| 15 |
#endif |
| 16 |
|
| 17 |
#if changeset |
| 18 |
$ cat >> $HGRCPATH << EOF |
| 19 |
> [experimental] |
| 20 |
> copies.read-from = changeset-only |
| 21 |
> copies.write-to = changeset-only |
| 22 |
> EOF |
| 23 |
#endif |
| 24 |
|
| 25 |
#if sidedata |
| 26 |
$ cat >> $HGRCPATH << EOF |
| 27 |
> [format] |
| 28 |
> exp-use-copies-side-data-changeset = yes |
| 29 |
> EOF |
| 30 |
#endif |
| 31 |
|
| 32 |
$ REPONUM=0 |
| 33 |
$ newrepo() { |
| 34 |
> cd $TESTTMP |
| 35 |
> REPONUM=`expr $REPONUM + 1` |
| 36 |
> hg init repo-$REPONUM |
| 37 |
> cd repo-$REPONUM |
| 38 |
> } |
| 39 |
|
| 40 |
Simple rename case |
| 41 |
$ newrepo |
| 42 |
$ echo x > x |
| 43 |
$ hg ci -Aqm 'add x' |
| 44 |
$ hg mv x y |
| 45 |
$ hg debugp1copies |
| 46 |
x -> y |
| 47 |
$ hg debugp2copies |
| 48 |
$ hg ci -m 'rename x to y' |
| 49 |
$ hg l |
| 50 |
@ 1 rename x to y |
| 51 |
| x y |
| 52 |
o 0 add x |
| 53 |
x |
| 54 |
$ hg debugp1copies -r 1 |
| 55 |
x -> y |
| 56 |
$ hg debugpathcopies 0 1 |
| 57 |
x -> y |
| 58 |
$ hg debugpathcopies 1 0 |
| 59 |
y -> x |
| 60 |
Test filtering copies by path. We do filtering by destination. |
| 61 |
$ hg debugpathcopies 0 1 x |
| 62 |
$ hg debugpathcopies 1 0 x |
| 63 |
y -> x |
| 64 |
$ hg debugpathcopies 0 1 y |
| 65 |
x -> y |
| 66 |
$ hg debugpathcopies 1 0 y |
| 67 |
|
| 68 |
Copies not including commit changes |
| 69 |
$ newrepo |
| 70 |
$ echo x > x |
| 71 |
$ hg ci -Aqm 'add x' |
| 72 |
$ hg mv x y |
| 73 |
$ hg debugpathcopies . . |
| 74 |
$ hg debugpathcopies . 'wdir()' |
| 75 |
x -> y |
| 76 |
$ hg debugpathcopies 'wdir()' . |
| 77 |
y -> x |
| 78 |
|
| 79 |
Copy a file onto another file |
| 80 |
$ newrepo |
| 81 |
$ echo x > x |
| 82 |
$ echo y > y |
| 83 |
$ hg ci -Aqm 'add x and y' |
| 84 |
$ hg cp -f x y |
| 85 |
$ hg debugp1copies |
| 86 |
x -> y |
| 87 |
$ hg debugp2copies |
| 88 |
$ hg ci -m 'copy x onto y' |
| 89 |
$ hg l |
| 90 |
@ 1 copy x onto y |
| 91 |
| y |
| 92 |
o 0 add x and y |
| 93 |
x y |
| 94 |
$ hg debugp1copies -r 1 |
| 95 |
x -> y |
| 96 |
$ hg debugpathcopies 0 1 |
| 97 |
x -> y (no-filelog !) |
| 98 |
$ hg debugpathcopies 0 1 --config devel.copy-tracing.trace-all-files=yes |
| 99 |
x -> y |
| 100 |
|
| 101 |
Copy a file onto another file with same content. If metadata is stored in changeset, this does not |
| 102 |
produce a new filelog entry. The changeset's "files" entry should still list the file. |
| 103 |
$ newrepo |
| 104 |
$ echo x > x |
| 105 |
$ echo x > x2 |
| 106 |
$ hg ci -Aqm 'add x and x2 with same content' |
| 107 |
$ hg cp -f x x2 |
| 108 |
$ hg ci -m 'copy x onto x2' |
| 109 |
$ hg l |
| 110 |
@ 1 copy x onto x2 |
| 111 |
| x2 |
| 112 |
o 0 add x and x2 with same content |
| 113 |
x x2 |
| 114 |
$ hg debugp1copies -r 1 |
| 115 |
x -> x2 |
| 116 |
$ hg debugpathcopies 0 1 |
| 117 |
x -> x2 (no-filelog !) |
| 118 |
$ hg debugpathcopies 0 1 --config devel.copy-tracing.trace-all-files=yes |
| 119 |
x -> x2 |
| 120 |
|
| 121 |
Rename file in a loop: x->y->z->x |
| 122 |
$ newrepo |
| 123 |
$ echo x > x |
| 124 |
$ hg ci -Aqm 'add x' |
| 125 |
$ hg mv x y |
| 126 |
$ hg debugp1copies |
| 127 |
x -> y |
| 128 |
$ hg debugp2copies |
| 129 |
$ hg ci -m 'rename x to y' |
| 130 |
$ hg mv y z |
| 131 |
$ hg ci -m 'rename y to z' |
| 132 |
$ hg mv z x |
| 133 |
$ hg ci -m 'rename z to x' |
| 134 |
$ hg l |
| 135 |
@ 3 rename z to x |
| 136 |
| x z |
| 137 |
o 2 rename y to z |
| 138 |
| y z |
| 139 |
o 1 rename x to y |
| 140 |
| x y |
| 141 |
o 0 add x |
| 142 |
x |
| 143 |
$ hg debugpathcopies 0 3 |
| 144 |
|
| 145 |
Copy x to z, then remove z, then copy x2 (same content as x) to z. With copy metadata in the |
| 146 |
changeset, the two copies here will have the same filelog entry, so ctx['z'].introrev() might point |
| 147 |
to the first commit that added the file. We should still report the copy as being from x2. |
| 148 |
$ newrepo |
| 149 |
$ echo x > x |
| 150 |
$ echo x > x2 |
| 151 |
$ hg ci -Aqm 'add x and x2 with same content' |
| 152 |
$ hg cp x z |
| 153 |
$ hg ci -qm 'copy x to z' |
| 154 |
$ hg rm z |
| 155 |
$ hg ci -m 'remove z' |
| 156 |
$ hg cp x2 z |
| 157 |
$ hg ci -m 'copy x2 to z' |
| 158 |
$ hg l |
| 159 |
@ 3 copy x2 to z |
| 160 |
| z |
| 161 |
o 2 remove z |
| 162 |
| z |
| 163 |
o 1 copy x to z |
| 164 |
| z |
| 165 |
o 0 add x and x2 with same content |
| 166 |
x x2 |
| 167 |
$ hg debugp1copies -r 3 |
| 168 |
x2 -> z |
| 169 |
$ hg debugpathcopies 0 3 |
| 170 |
x2 -> z |
| 171 |
|
| 172 |
Create x and y, then rename them both to the same name, but on different sides of a fork |
| 173 |
$ newrepo |
| 174 |
$ echo x > x |
| 175 |
$ echo y > y |
| 176 |
$ hg ci -Aqm 'add x and y' |
| 177 |
$ hg mv x z |
| 178 |
$ hg ci -qm 'rename x to z' |
| 179 |
$ hg co -q 0 |
| 180 |
$ hg mv y z |
| 181 |
$ hg ci -qm 'rename y to z' |
| 182 |
$ hg l |
| 183 |
@ 2 rename y to z |
| 184 |
| y z |
| 185 |
| o 1 rename x to z |
| 186 |
|/ x z |
| 187 |
o 0 add x and y |
| 188 |
x y |
| 189 |
$ hg debugpathcopies 1 2 |
| 190 |
z -> x |
| 191 |
y -> z |
| 192 |
|
| 193 |
Fork renames x to y on one side and removes x on the other |
| 194 |
$ newrepo |
| 195 |
$ echo x > x |
| 196 |
$ hg ci -Aqm 'add x' |
| 197 |
$ hg mv x y |
| 198 |
$ hg ci -m 'rename x to y' |
| 199 |
$ hg co -q 0 |
| 200 |
$ hg rm x |
| 201 |
$ hg ci -m 'remove x' |
| 202 |
created new head |
| 203 |
$ hg l |
| 204 |
@ 2 remove x |
| 205 |
| x |
| 206 |
| o 1 rename x to y |
| 207 |
|/ x y |
| 208 |
o 0 add x |
| 209 |
x |
| 210 |
$ hg debugpathcopies 1 2 |
| 211 |
|
| 212 |
Merge rename from other branch |
| 213 |
$ newrepo |
| 214 |
$ echo x > x |
| 215 |
$ hg ci -Aqm 'add x' |
| 216 |
$ hg mv x y |
| 217 |
$ hg ci -m 'rename x to y' |
| 218 |
$ hg co -q 0 |
| 219 |
$ echo z > z |
| 220 |
$ hg ci -Aqm 'add z' |
| 221 |
$ hg merge -q 1 |
| 222 |
$ hg debugp1copies |
| 223 |
$ hg debugp2copies |
| 224 |
$ hg ci -m 'merge rename from p2' |
| 225 |
$ hg l |
| 226 |
@ 3 merge rename from p2 |
| 227 |
|\ |
| 228 |
| o 2 add z |
| 229 |
| | z |
| 230 |
o | 1 rename x to y |
| 231 |
|/ x y |
| 232 |
o 0 add x |
| 233 |
x |
| 234 |
Perhaps we should indicate the rename here, but `hg status` is documented to be weird during |
| 235 |
merges, so... |
| 236 |
$ hg debugp1copies -r 3 |
| 237 |
$ hg debugp2copies -r 3 |
| 238 |
$ hg debugpathcopies 0 3 |
| 239 |
x -> y |
| 240 |
$ hg debugpathcopies 1 2 |
| 241 |
y -> x |
| 242 |
$ hg debugpathcopies 1 3 |
| 243 |
$ hg debugpathcopies 2 3 |
| 244 |
x -> y |
| 245 |
|
| 246 |
Copy file from either side in a merge |
| 247 |
$ newrepo |
| 248 |
$ echo x > x |
| 249 |
$ hg ci -Aqm 'add x' |
| 250 |
$ hg co -q null |
| 251 |
$ echo y > y |
| 252 |
$ hg ci -Aqm 'add y' |
| 253 |
$ hg merge -q 0 |
| 254 |
$ hg cp y z |
| 255 |
$ hg debugp1copies |
| 256 |
y -> z |
| 257 |
$ hg debugp2copies |
| 258 |
$ hg ci -m 'copy file from p1 in merge' |
| 259 |
$ hg co -q 1 |
| 260 |
$ hg merge -q 0 |
| 261 |
$ hg cp x z |
| 262 |
$ hg debugp1copies |
| 263 |
$ hg debugp2copies |
| 264 |
x -> z |
| 265 |
$ hg ci -qm 'copy file from p2 in merge' |
| 266 |
$ hg l |
| 267 |
@ 3 copy file from p2 in merge |
| 268 |
|\ z |
| 269 |
+---o 2 copy file from p1 in merge |
| 270 |
| |/ z |
| 271 |
| o 1 add y |
| 272 |
| y |
| 273 |
o 0 add x |
| 274 |
x |
| 275 |
$ hg debugp1copies -r 2 |
| 276 |
y -> z |
| 277 |
$ hg debugp2copies -r 2 |
| 278 |
$ hg debugpathcopies 1 2 |
| 279 |
y -> z |
| 280 |
$ hg debugpathcopies 0 2 |
| 281 |
$ hg debugp1copies -r 3 |
| 282 |
$ hg debugp2copies -r 3 |
| 283 |
x -> z |
| 284 |
$ hg debugpathcopies 1 3 |
| 285 |
$ hg debugpathcopies 0 3 |
| 286 |
x -> z |
| 287 |
|
| 288 |
Copy file that exists on both sides of the merge, same content on both sides |
| 289 |
$ newrepo |
| 290 |
$ echo x > x |
| 291 |
$ hg ci -Aqm 'add x on branch 1' |
| 292 |
$ hg co -q null |
| 293 |
$ echo x > x |
| 294 |
$ hg ci -Aqm 'add x on branch 2' |
| 295 |
$ hg merge -q 0 |
| 296 |
$ hg cp x z |
| 297 |
$ hg debugp1copies |
| 298 |
x -> z |
| 299 |
$ hg debugp2copies |
| 300 |
$ hg ci -qm 'merge' |
| 301 |
$ hg l |
| 302 |
@ 2 merge |
| 303 |
|\ z |
| 304 |
| o 1 add x on branch 2 |
| 305 |
| x |
| 306 |
o 0 add x on branch 1 |
| 307 |
x |
| 308 |
$ hg debugp1copies -r 2 |
| 309 |
x -> z |
| 310 |
$ hg debugp2copies -r 2 |
| 311 |
It's a little weird that it shows up on both sides |
| 312 |
$ hg debugpathcopies 1 2 |
| 313 |
x -> z |
| 314 |
$ hg debugpathcopies 0 2 |
| 315 |
x -> z (filelog !) |
| 316 |
|
| 317 |
Copy file that exists on both sides of the merge, different content |
| 318 |
$ newrepo |
| 319 |
$ echo branch1 > x |
| 320 |
$ hg ci -Aqm 'add x on branch 1' |
| 321 |
$ hg co -q null |
| 322 |
$ echo branch2 > x |
| 323 |
$ hg ci -Aqm 'add x on branch 2' |
| 324 |
$ hg merge -q 0 |
| 325 |
warning: conflicts while merging x! (edit, then use 'hg resolve --mark') |
| 326 |
[1] |
| 327 |
$ echo resolved > x |
| 328 |
$ hg resolve -m x |
| 329 |
(no more unresolved files) |
| 330 |
$ hg cp x z |
| 331 |
$ hg debugp1copies |
| 332 |
x -> z |
| 333 |
$ hg debugp2copies |
| 334 |
$ hg ci -qm 'merge' |
| 335 |
$ hg l |
| 336 |
@ 2 merge |
| 337 |
|\ x z |
| 338 |
| o 1 add x on branch 2 |
| 339 |
| x |
| 340 |
o 0 add x on branch 1 |
| 341 |
x |
| 342 |
$ hg debugp1copies -r 2 |
| 343 |
x -> z (changeset !) |
| 344 |
x -> z (sidedata !) |
| 345 |
$ hg debugp2copies -r 2 |
| 346 |
x -> z (no-changeset no-sidedata !) |
| 347 |
$ hg debugpathcopies 1 2 |
| 348 |
x -> z (changeset !) |
| 349 |
x -> z (sidedata !) |
| 350 |
$ hg debugpathcopies 0 2 |
| 351 |
x -> z (no-changeset no-sidedata !) |
| 352 |
|
| 353 |
Copy x->y on one side of merge and copy x->z on the other side. Pathcopies from one parent |
| 354 |
of the merge to the merge should include the copy from the other side. |
| 355 |
$ newrepo |
| 356 |
$ echo x > x |
| 357 |
$ hg ci -Aqm 'add x' |
| 358 |
$ hg cp x y |
| 359 |
$ hg ci -qm 'copy x to y' |
| 360 |
$ hg co -q 0 |
| 361 |
$ hg cp x z |
| 362 |
$ hg ci -qm 'copy x to z' |
| 363 |
$ hg merge -q 1 |
| 364 |
$ hg ci -m 'merge copy x->y and copy x->z' |
| 365 |
$ hg l |
| 366 |
@ 3 merge copy x->y and copy x->z |
| 367 |
|\ |
| 368 |
| o 2 copy x to z |
| 369 |
| | z |
| 370 |
o | 1 copy x to y |
| 371 |
|/ y |
| 372 |
o 0 add x |
| 373 |
x |
| 374 |
$ hg debugp1copies -r 3 |
| 375 |
$ hg debugp2copies -r 3 |
| 376 |
$ hg debugpathcopies 2 3 |
| 377 |
x -> y |
| 378 |
$ hg debugpathcopies 1 3 |
| 379 |
x -> z |
| 380 |
|
| 381 |
Copy x->y on two separate branches. Pathcopies from one branch to the other |
| 382 |
should not report the copy. |
| 383 |
$ newrepo |
| 384 |
$ echo x > x |
| 385 |
$ hg ci -Aqm 'add x' |
| 386 |
$ hg cp x y |
| 387 |
$ hg ci -qm 'copy x to y' |
| 388 |
$ hg co -q 0 |
| 389 |
$ hg graft 1 -q |
| 390 |
$ hg l |
| 391 |
@ 2 copy x to y |
| 392 |
| y |
| 393 |
| o 1 copy x to y |
| 394 |
|/ y |
| 395 |
o 0 add x |
| 396 |
x |
| 397 |
$ hg debugp1copies -r 1 |
| 398 |
x -> y |
| 399 |
$ hg debugp1copies -r 2 |
| 400 |
x -> y |
| 401 |
$ hg debugpathcopies 1 2 |
| 402 |
$ hg debugpathcopies 2 1 |
| 403 |
|
| 404 |
Copy x to y on one side of merge, create y and rename to z on the other side. |
| 405 |
$ newrepo |
| 406 |
$ echo x > x |
| 407 |
$ hg ci -Aqm 'add x' |
| 408 |
$ hg cp x y |
| 409 |
$ hg ci -qm 'copy x to y' |
| 410 |
$ hg co -q 0 |
| 411 |
$ echo y > y |
| 412 |
$ hg ci -Aqm 'add y' |
| 413 |
$ hg mv y z |
| 414 |
$ hg ci -m 'rename y to z' |
| 415 |
$ hg merge -q 1 |
| 416 |
$ hg ci -m 'merge' |
| 417 |
$ hg l |
| 418 |
@ 4 merge |
| 419 |
|\ |
| 420 |
| o 3 rename y to z |
| 421 |
| | y z |
| 422 |
| o 2 add y |
| 423 |
| | y |
| 424 |
o | 1 copy x to y |
| 425 |
|/ y |
| 426 |
o 0 add x |
| 427 |
x |
| 428 |
$ hg debugp1copies -r 3 |
| 429 |
y -> z |
| 430 |
$ hg debugp2copies -r 3 |
| 431 |
$ hg debugpathcopies 2 3 |
| 432 |
y -> z |
| 433 |
$ hg debugpathcopies 1 3 |
| 434 |
y -> z (no-filelog !) |
| 435 |
|
| 436 |
Create x and y, then rename x to z on one side of merge, and rename y to z and |
| 437 |
modify z on the other side. When storing copies in the changeset, we don't |
| 438 |
filter out copies whose target was created on the other side of the merge. |
| 439 |
$ newrepo |
| 440 |
$ echo x > x |
| 441 |
$ echo y > y |
| 442 |
$ hg ci -Aqm 'add x and y' |
| 443 |
$ hg mv x z |
| 444 |
$ hg ci -qm 'rename x to z' |
| 445 |
$ hg co -q 0 |
| 446 |
$ hg mv y z |
| 447 |
$ hg ci -qm 'rename y to z' |
| 448 |
$ echo z >> z |
| 449 |
$ hg ci -m 'modify z' |
| 450 |
$ hg merge -q 1 |
| 451 |
warning: conflicts while merging z! (edit, then use 'hg resolve --mark') |
| 452 |
[1] |
| 453 |
$ echo z > z |
| 454 |
$ hg resolve -qm z |
| 455 |
$ hg ci -m 'merge 1 into 3' |
| 456 |
Try merging the other direction too |
| 457 |
$ hg co -q 1 |
| 458 |
$ hg merge -q 3 |
| 459 |
warning: conflicts while merging z! (edit, then use 'hg resolve --mark') |
| 460 |
[1] |
| 461 |
$ echo z > z |
| 462 |
$ hg resolve -qm z |
| 463 |
$ hg ci -m 'merge 3 into 1' |
| 464 |
created new head |
| 465 |
$ hg l |
| 466 |
@ 5 merge 3 into 1 |
| 467 |
|\ z |
| 468 |
+---o 4 merge 1 into 3 |
| 469 |
| |/ z |
| 470 |
| o 3 modify z |
| 471 |
| | z |
| 472 |
| o 2 rename y to z |
| 473 |
| | y z |
| 474 |
o | 1 rename x to z |
| 475 |
|/ x z |
| 476 |
o 0 add x and y |
| 477 |
x y |
| 478 |
$ hg debugpathcopies 1 4 |
| 479 |
y -> z (no-filelog !) |
| 480 |
$ hg debugpathcopies 2 4 |
| 481 |
x -> z (no-filelog !) |
| 482 |
$ hg debugpathcopies 0 4 |
| 483 |
x -> z (filelog !) |
| 484 |
y -> z (no-filelog !) |
| 485 |
$ hg debugpathcopies 1 5 |
| 486 |
y -> z (no-filelog !) |
| 487 |
$ hg debugpathcopies 2 5 |
| 488 |
x -> z (no-filelog !) |
| 489 |
$ hg debugpathcopies 0 5 |
| 490 |
x -> z |
| 491 |
|
| 492 |
Create x and y, then remove y and rename x to y on one side of merge, and |
| 493 |
modify x on the other side. The modification to x from the second side |
| 494 |
should be propagated to y. |
| 495 |
$ newrepo |
| 496 |
$ echo original > x |
| 497 |
$ hg add x |
| 498 |
$ echo unrelated > y |
| 499 |
$ hg add y |
| 500 |
$ hg commit -m 'add x and y' |
| 501 |
$ hg remove y |
| 502 |
$ hg commit -m 'remove y' |
| 503 |
$ hg rename x y |
| 504 |
$ hg commit -m 'rename x to y' |
| 505 |
$ hg checkout -q 0 |
| 506 |
$ echo modified > x |
| 507 |
$ hg commit -m 'modify x' |
| 508 |
created new head |
| 509 |
$ hg l |
| 510 |
@ 3 modify x |
| 511 |
| x |
| 512 |
| o 2 rename x to y |
| 513 |
| | x y |
| 514 |
| o 1 remove y |
| 515 |
|/ y |
| 516 |
o 0 add x and y |
| 517 |
x y |
| 518 |
#if filelog |
| 519 |
$ hg merge 2 |
| 520 |
file 'x' was deleted in other [merge rev] but was modified in local [working copy]. |
| 521 |
You can use (c)hanged version, (d)elete, or leave (u)nresolved. |
| 522 |
What do you want to do? u |
| 523 |
1 files updated, 0 files merged, 0 files removed, 1 files unresolved |
| 524 |
use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
| 525 |
[1] |
| 526 |
This should ideally be "modified", but we will probably not be able to fix |
| 527 |
that in the filelog case. |
| 528 |
$ cat y |
| 529 |
original |
| 530 |
#else |
| 531 |
$ hg merge 2 |
| 532 |
merging x and y to y |
| 533 |
0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
| 534 |
(branch merge, don't forget to commit) |
| 535 |
$ cat y |
| 536 |
modified |
| 537 |
#endif |
| 538 |
Same as above, but in the opposite direction |
| 539 |
#if filelog |
| 540 |
$ hg co -qC 2 |
| 541 |
$ hg merge 3 |
| 542 |
file 'x' was deleted in local [working copy] but was modified in other [merge rev]. |
| 543 |
You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved. |
| 544 |
What do you want to do? u |
| 545 |
0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
| 546 |
use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
| 547 |
[1] |
| 548 |
BROKEN: should be "modified" |
| 549 |
$ cat y |
| 550 |
original |
| 551 |
#else |
| 552 |
$ hg co -qC 2 |
| 553 |
$ hg merge 3 |
| 554 |
merging y and x to y |
| 555 |
0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
| 556 |
(branch merge, don't forget to commit) |
| 557 |
$ cat y |
| 558 |
modified |
| 559 |
#endif |
| 560 |
|
| 561 |
Create x and y, then rename x to z on one side of merge, and rename y to z and |
| 562 |
then delete z on the other side. |
| 563 |
$ newrepo |
| 564 |
$ echo x > x |
| 565 |
$ echo y > y |
| 566 |
$ hg ci -Aqm 'add x and y' |
| 567 |
$ hg mv x z |
| 568 |
$ hg ci -qm 'rename x to z' |
| 569 |
$ hg co -q 0 |
| 570 |
$ hg mv y z |
| 571 |
$ hg ci -qm 'rename y to z' |
| 572 |
$ hg rm z |
| 573 |
$ hg ci -m 'delete z' |
| 574 |
$ hg merge -q 1 |
| 575 |
$ echo z > z |
| 576 |
$ hg ci -m 'merge 1 into 3' |
| 577 |
Try merging the other direction too |
| 578 |
$ hg co -q 1 |
| 579 |
$ hg merge -q 3 |
| 580 |
$ echo z > z |
| 581 |
$ hg ci -m 'merge 3 into 1' |
| 582 |
created new head |
| 583 |
$ hg l |
| 584 |
@ 5 merge 3 into 1 |
| 585 |
|\ z |
| 586 |
+---o 4 merge 1 into 3 |
| 587 |
| |/ z |
| 588 |
| o 3 delete z |
| 589 |
| | z |
| 590 |
| o 2 rename y to z |
| 591 |
| | y z |
| 592 |
o | 1 rename x to z |
| 593 |
|/ x z |
| 594 |
o 0 add x and y |
| 595 |
x y |
| 596 |
$ hg debugpathcopies 1 4 |
| 597 |
$ hg debugpathcopies 2 4 |
| 598 |
x -> z (no-filelog !) |
| 599 |
$ hg debugpathcopies 0 4 |
| 600 |
x -> z (no-changeset no-compatibility !) |
| 601 |
$ hg debugpathcopies 1 5 |
| 602 |
$ hg debugpathcopies 2 5 |
| 603 |
x -> z (no-filelog !) |
| 604 |
$ hg debugpathcopies 0 5 |
| 605 |
x -> z |
| 606 |
|
| 607 |
|
| 608 |
Test for a case in fullcopytracing algorithm where neither of the merging csets |
| 609 |
is a descendant of the merge base. This test reflects that the algorithm |
| 610 |
correctly finds the copies: |
| 611 |
|
| 612 |
$ cat >> $HGRCPATH << EOF |
| 613 |
> [experimental] |
| 614 |
> evolution.createmarkers=True |
| 615 |
> evolution.allowunstable=True |
| 616 |
> EOF |
| 617 |
|
| 618 |
$ newrepo |
| 619 |
$ echo a > a |
| 620 |
$ hg add a |
| 621 |
$ hg ci -m "added a" |
| 622 |
$ echo b > b |
| 623 |
$ hg add b |
| 624 |
$ hg ci -m "added b" |
| 625 |
|
| 626 |
$ hg mv b b1 |
| 627 |
$ hg ci -m "rename b to b1" |
| 628 |
|
| 629 |
$ hg up ".^" |
| 630 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 631 |
$ echo d > d |
| 632 |
$ hg add d |
| 633 |
$ hg ci -m "added d" |
| 634 |
created new head |
| 635 |
|
| 636 |
$ echo baba >> b |
| 637 |
$ hg ci --amend -m "added d, modified b" |
| 638 |
|
| 639 |
$ hg l --hidden |
| 640 |
@ 4 added d, modified b |
| 641 |
| b d |
| 642 |
| x 3 added d |
| 643 |
|/ d |
| 644 |
| o 2 rename b to b1 |
| 645 |
|/ b b1 |
| 646 |
o 1 added b |
| 647 |
| b |
| 648 |
o 0 added a |
| 649 |
a |
| 650 |
|
| 651 |
Grafting revision 4 on top of revision 2, showing that it respect the rename: |
| 652 |
|
| 653 |
$ hg up 2 -q |
| 654 |
$ hg graft -r 4 --base 3 --hidden |
| 655 |
grafting 4:af28412ec03c "added d, modified b" (tip) (no-changeset !) |
| 656 |
grafting 4:6325ca0b7a1c "added d, modified b" (tip) (changeset !) |
| 657 |
merging b1 and b to b1 |
| 658 |
|
| 659 |
$ hg l -l1 -p |
| 660 |
@ 5 added d, modified b |
| 661 |
| b1 |
| 662 |
~ diff -r 5a4825cc2926 -r 94a2f1a0e8e2 b1 (no-changeset !) |
| 663 |
~ diff -r 0a0ed3b3251c -r d544fb655520 b1 (changeset !) |
| 664 |
--- a/b1 Thu Jan 01 00:00:00 1970 +0000 |
| 665 |
+++ b/b1 Thu Jan 01 00:00:00 1970 +0000 |
| 666 |
@@ -1,1 +1,2 @@ |
| 667 |
b |
| 668 |
+baba |
| 669 |
|
| 670 |
Test to make sure that fullcopytracing algorithm doesn't fail when neither of the |
| 671 |
merging csets is a descendant of the base. |
| 672 |
------------------------------------------------------------------------------------------------- |
| 673 |
|
| 674 |
$ newrepo |
| 675 |
$ echo a > a |
| 676 |
$ hg add a |
| 677 |
$ hg ci -m "added a" |
| 678 |
$ echo b > b |
| 679 |
$ hg add b |
| 680 |
$ hg ci -m "added b" |
| 681 |
|
| 682 |
$ echo foobar > willconflict |
| 683 |
$ hg add willconflict |
| 684 |
$ hg ci -m "added willconflict" |
| 685 |
$ echo c > c |
| 686 |
$ hg add c |
| 687 |
$ hg ci -m "added c" |
| 688 |
|
| 689 |
$ hg l |
| 690 |
@ 3 added c |
| 691 |
| c |
| 692 |
o 2 added willconflict |
| 693 |
| willconflict |
| 694 |
o 1 added b |
| 695 |
| b |
| 696 |
o 0 added a |
| 697 |
a |
| 698 |
|
| 699 |
$ hg up ".^^" |
| 700 |
0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
| 701 |
$ echo d > d |
| 702 |
$ hg add d |
| 703 |
$ hg ci -m "added d" |
| 704 |
created new head |
| 705 |
|
| 706 |
$ echo barfoo > willconflict |
| 707 |
$ hg add willconflict |
| 708 |
$ hg ci --amend -m "added willconflict and d" |
| 709 |
|
| 710 |
$ hg l |
| 711 |
@ 5 added willconflict and d |
| 712 |
| d willconflict |
| 713 |
| o 3 added c |
| 714 |
| | c |
| 715 |
| o 2 added willconflict |
| 716 |
|/ willconflict |
| 717 |
o 1 added b |
| 718 |
| b |
| 719 |
o 0 added a |
| 720 |
a |
| 721 |
|
| 722 |
$ hg rebase -r . -d 2 -t :other |
| 723 |
rebasing 5:5018b1509e94 tip "added willconflict and d" (no-changeset !) |
| 724 |
rebasing 5:af8d273bf580 tip "added willconflict and d" (changeset !) |
| 725 |
|
| 726 |
$ hg up 3 -q |
| 727 |
$ hg l --hidden |
| 728 |
o 6 added willconflict and d |
| 729 |
| d willconflict |
| 730 |
| x 5 added willconflict and d |
| 731 |
| | d willconflict |
| 732 |
| | x 4 added d |
| 733 |
| |/ d |
| 734 |
+---@ 3 added c |
| 735 |
| | c |
| 736 |
o | 2 added willconflict |
| 737 |
|/ willconflict |
| 738 |
o 1 added b |
| 739 |
| b |
| 740 |
o 0 added a |
| 741 |
a |
| 742 |
|
| 743 |
Now if we trigger a merge between revision 3 and 6 using base revision 4, |
| 744 |
neither of the merging csets will be a descendant of the base revision: |
| 745 |
|
| 746 |
$ hg graft -r 6 --base 4 --hidden -t :other |
| 747 |
grafting 6:99802e4f1e46 "added willconflict and d" (tip) (no-changeset !) |
| 748 |
grafting 6:b19f0df72728 "added willconflict and d" (tip) (changeset !) |