comparison tests/test-mv-cp-st-diff.t @ 42211:20fce2742399

tests: slightly modify a linkrev test to prepare for expanding it The test case checks that the copy tracing code doesn't get confused by linkrevs when walking a file's ancestors. This patch chnages the test slightly so a second commit is grafted, thus producing a second "bad" linkrev. I'll use this in the next patch to demonstrate a bug. Differential Revision: https://phab.mercurial-scm.org/D6321
author Martin von Zweigbergk <martinvonz@google.com>
date Sat, 27 Apr 2019 22:57:15 -0700
parents cf01616f8d96
children 7bb2f358a13b
comparison
equal deleted inserted replaced
42210:390ec72b8ea4 42211:20fce2742399
1622 Make a simple change 1622 Make a simple change
1623 1623
1624 $ echo change > f 1624 $ echo change > f
1625 $ hg ci -m 'change f' 1625 $ hg ci -m 'change f'
1626 1626
1627 Make a rename because we want to track renames. It is also important that the
1628 faulty linkrev is not only the "start" commit to ensure the linkrev will be
1629 used.
1630
1631 $ hg mv f renamed
1632 $ hg ci -m renamed
1633
1627 Make a second branch, we use a named branch to create a simple commit 1634 Make a second branch, we use a named branch to create a simple commit
1628 that does not touch f. 1635 that does not touch f.
1629 1636
1630 $ hg up -qr 'desc(empty)' 1637 $ hg up -qr 'desc(empty)'
1631 $ hg branch -q dev 1638 $ hg branch -q dev
1632 $ hg ci -Aqm dev 1639 $ hg ci -Aqm dev
1633 1640
1634 Graft the initial change, as f was untouched, we reuse the same entry and the 1641 Graft the initial change and the rename. As f was untouched, we reuse the same
1635 linkrev point to the older branch. 1642 entry and the linkrev point to the older branch.
1636 1643
1637 $ hg graft -q 'desc(change)' 1644 $ hg graft -q 'desc(change)'
1638 1645 $ hg graft -q 'desc(renamed)'
1639 Make a rename because we want to track renames. It is also important that the
1640 faulty linkrev is not the "start" commit to ensure the linkrev will be used.
1641
1642 $ hg mv f renamed
1643 $ hg ci -m renamed
1644 1646
1645 $ hg log -G -T '{rev} {desc}' 1647 $ hg log -G -T '{rev} {desc}'
1646 @ 4 renamed 1648 @ 5 renamed
1647 | 1649 |
1648 o 3 change f 1650 o 4 change f
1649 | 1651 |
1650 o 2 dev 1652 o 3 dev
1651 | 1653 |
1654 | o 2 renamed
1655 | |
1652 | o 1 change f 1656 | o 1 change f
1653 |/ 1657 |/
1654 o 0 empty f 1658 o 0 empty f
1655 1659
1656 1660
1657 The copy tracking should still reach rev 2 (branch creation). 1661 The copy tracking should still reach rev 3 (branch creation).
1658 accessing the parent of 4 (renamed) should not jump use to revision 1. 1662 accessing the parent of 5 (renamed) should not jump use to revision 1.
1659 1663
1660 $ hg diff --git -r 'desc(dev)' -r . 1664 $ hg diff --git -r 'desc(dev)' -r .
1661 diff --git a/f b/renamed 1665 diff --git a/f b/renamed
1662 rename from f 1666 rename from f
1663 rename to renamed 1667 rename to renamed
1667 +change 1671 +change
1668 1672
1669 Check debug output for copy tracing 1673 Check debug output for copy tracing
1670 1674
1671 $ hg status --copies --rev 'desc(dev)' --rev . --config devel.debug.copies=yes --debug 1675 $ hg status --copies --rev 'desc(dev)' --rev . --config devel.debug.copies=yes --debug
1672 debug.copies: searching copies from a51f36ab1704 to 7935fd48a8f9 1676 debug.copies: searching copies from a51f36ab1704 to 1f4aa1fd627b
1673 debug.copies: search mode: forward 1677 debug.copies: search mode: forward
1674 debug.copies: looking into rename from a51f36ab1704 to 7935fd48a8f9 1678 debug.copies: looking into rename from a51f36ab1704 to 1f4aa1fd627b
1675 debug.copies: search limit: 2 1679 debug.copies: search limit: 3
1676 debug.copies: missing file to search: 1 1680 debug.copies: missing files to search: 1
1677 debug.copies: tracing file: renamed 1681 debug.copies: tracing file: renamed
1678 debug.copies: rename of: f 1682 debug.copies: rename of: f
1679 debug.copies: time: * seconds (glob) 1683 debug.copies: time: * seconds (glob)
1680 A renamed 1684 A renamed
1681 f 1685 f