Previously, no explicit tests existed for this feature. The added tests demonstrate that git.findcopiesharder results in copy metadata being added to changesets adding files that were unmodified by that changeset.
Unified · Split
| @@ -454,3 +454,145 @@ Regenerate the Git metadata and compare the hashes · 453 unmodified lines | |||
| 454 | e1348449e0c3a417b086ed60fc13f068d4aa8b26 gamma | 454 | e1348449e0c3a417b086ed60fc13f068d4aa8b26 gamma |
| 455 | cc83241f39927232f690d370894960b0d1943a0e beta | 455 | cc83241f39927232f690d370894960b0d1943a0e beta |
| 456 | 938bb65bb322eb4a3558bec4cdc8a680c4d1794c alpha | 456 | 938bb65bb322eb4a3558bec4cdc8a680c4d1794c alpha |
| 457 | |||
| 458 | Test findcopiesharder | ||
| 459 | |||
| 460 | $ cd $TESTTMP | ||
| 461 | $ git init -q gitcopyharder | ||
| 462 | $ cd gitcopyharder | ||
| 463 | $ cat >> file0 << EOF | ||
| 464 | > 1 | ||
| 465 | > 2 | ||
| 466 | > 3 | ||
| 467 | > 4 | ||
| 468 | > 5 | ||
| 469 | > EOF | ||
| 470 | $ git add file0 | ||
| 471 | $ fn_git_commit -m file0 | ||
| 472 | $ cp file0 file1 | ||
| 473 | $ git add file1 | ||
| 474 | $ fn_git_commit -m file1 | ||
| 475 | $ cp file0 file2 | ||
| 476 | $ echo 6 >> file2 | ||
| 477 | $ git add file2 | ||
| 478 | $ fn_git_commit -m file2 | ||
| 479 | |||
| 480 | $ cd .. | ||
| 481 | |||
| 482 | Clone without findcopiesharder does not find copies from unmodified files | ||
| 483 | |||
| 484 | $ hg clone gitcopyharder hgnocopyharder | ||
| 485 | importing git objects into hg | ||
| 486 | updating to branch default | ||
| 487 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||
| 488 | $ hg -R hgnocopyharder export 1::2 | ||
| 489 | # HG changeset patch | ||
| 490 | # User test <test@example.org> | ||
| 491 | # Date 1167609621 0 | ||
| 492 | # Mon Jan 01 00:00:21 2007 +0000 | ||
| 493 | # Node ID 555831c93e2a250e5ba42efad45bf7ba71da13e4 | ||
| 494 | # Parent b45d023c6842337ffe694663a44aa672d311081c | ||
| 495 | file1 | ||
| 496 | |||
| 497 | diff --git a/file1 b/file1 | ||
| 498 | new file mode 100644 | ||
| 499 | --- /dev/null | ||
| 500 | +++ b/file1 | ||
| 501 | @@ -0,0 +1,5 @@ | ||
| 502 | +1 | ||
| 503 | +2 | ||
| 504 | +3 | ||
| 505 | +4 | ||
| 506 | +5 | ||
| 507 | # HG changeset patch | ||
| 508 | # User test <test@example.org> | ||
| 509 | # Date 1167609622 0 | ||
| 510 | # Mon Jan 01 00:00:22 2007 +0000 | ||
| 511 | # Node ID ec77ccdbefe023eb9898b0399f84f670c8c0f5fc | ||
| 512 | # Parent 555831c93e2a250e5ba42efad45bf7ba71da13e4 | ||
| 513 | file2 | ||
| 514 | |||
| 515 | diff --git a/file2 b/file2 | ||
| 516 | new file mode 100644 | ||
| 517 | --- /dev/null | ||
| 518 | +++ b/file2 | ||
| 519 | @@ -0,0 +1,6 @@ | ||
| 520 | +1 | ||
| 521 | +2 | ||
| 522 | +3 | ||
| 523 | +4 | ||
| 524 | +5 | ||
| 525 | +6 | ||
| 526 | |||
| 527 | findcopiesharder finds copies from unmodified files if similarity is met | ||
| 528 | |||
| 529 | $ hg --config git.findcopiesharder=true clone gitcopyharder hgcopyharder0 | ||
| 530 | importing git objects into hg | ||
| 531 | updating to branch default | ||
| 532 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||
| 533 | $ hg -R hgcopyharder0 export 1::2 | ||
| 534 | # HG changeset patch | ||
| 535 | # User test <test@example.org> | ||
| 536 | # Date 1167609621 0 | ||
| 537 | # Mon Jan 01 00:00:21 2007 +0000 | ||
| 538 | # Node ID cd05a87103eed9d270fc05b62b00f48e174ab960 | ||
| 539 | # Parent b45d023c6842337ffe694663a44aa672d311081c | ||
| 540 | file1 | ||
| 541 | |||
| 542 | diff --git a/file0 b/file1 | ||
| 543 | copy from file0 | ||
| 544 | copy to file1 | ||
| 545 | # HG changeset patch | ||
| 546 | # User test <test@example.org> | ||
| 547 | # Date 1167609622 0 | ||
| 548 | # Mon Jan 01 00:00:22 2007 +0000 | ||
| 549 | # Node ID 9b30998342729c7357d418bebed7399986cfe643 | ||
| 550 | # Parent cd05a87103eed9d270fc05b62b00f48e174ab960 | ||
| 551 | file2 | ||
| 552 | |||
| 553 | diff --git a/file0 b/file2 | ||
| 554 | copy from file0 | ||
| 555 | copy to file2 | ||
| 556 | --- a/file0 | ||
| 557 | +++ b/file2 | ||
| 558 | @@ -3,3 +3,4 @@ | ||
| 559 | 3 | ||
| 560 | 4 | ||
| 561 | 5 | ||
| 562 | +6 | ||
| 563 | |||
| 564 | $ hg --config git.findcopiesharder=true --config git.similarity=95 clone gitcopyharder hgcopyharder1 | ||
| 565 | importing git objects into hg | ||
| 566 | updating to branch default | ||
| 567 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||
| 568 | $ hg -R hgcopyharder1 export 1::2 | ||
| 569 | # HG changeset patch | ||
| 570 | # User test <test@example.org> | ||
| 571 | # Date 1167609621 0 | ||
| 572 | # Mon Jan 01 00:00:21 2007 +0000 | ||
| 573 | # Node ID cd05a87103eed9d270fc05b62b00f48e174ab960 | ||
| 574 | # Parent b45d023c6842337ffe694663a44aa672d311081c | ||
| 575 | file1 | ||
| 576 | |||
| 577 | diff --git a/file0 b/file1 | ||
| 578 | copy from file0 | ||
| 579 | copy to file1 | ||
| 580 | # HG changeset patch | ||
| 581 | # User test <test@example.org> | ||
| 582 | # Date 1167609622 0 | ||
| 583 | # Mon Jan 01 00:00:22 2007 +0000 | ||
| 584 | # Node ID d9d2e8cbf050772be31dccf78851f71dc547d139 | ||
| 585 | # Parent cd05a87103eed9d270fc05b62b00f48e174ab960 | ||
| 586 | file2 | ||
| 587 | |||
| 588 | diff --git a/file2 b/file2 | ||
| 589 | new file mode 100644 | ||
| 590 | --- /dev/null | ||
| 591 | +++ b/file2 | ||
| 592 | @@ -0,0 +1,6 @@ | ||
| 593 | +1 | ||
| 594 | +2 | ||
| 595 | +3 | ||
| 596 | +4 | ||
| 597 | +5 | ||
| 598 | +6 | ||