Mercurial > hg
comparison tests/test-graft.t @ 38453:5cdfc20bfd5f
graft: introduce --abort flag to abort interrupted graft
This patch introduces a new --abort flag to `hg graft` command which aborts an
interrupted graft and rollbacks to the state before graft.
The behavior when some of grafted changeset get's published while interrupted
graft or we have new descendants on grafted changesets is same as that of rebase
which is warn the user, don't strip and abort the abort the graft.
Tests are added for the new flag.
.. feature::
`hg graft` now has a `--abort` flag which aborts the interrupted graft and
rollbacks to state before the graft.
Differential Revision: https://phab.mercurial-scm.org/D3754
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 25 May 2018 18:16:38 +0530 |
parents | 50f5fc232c16 |
children | 622f79e3a1cb |
comparison
equal
deleted
inserted
replaced
38452:afb7e15392b9 | 38453:5cdfc20bfd5f |
---|---|
1668 |/ | 1668 |/ |
1669 o 1:5f6d8a4bf34a added b | 1669 o 1:5f6d8a4bf34a added b |
1670 | | 1670 | |
1671 o 0:9092f1db7931 added a | 1671 o 0:9092f1db7931 added a |
1672 | 1672 |
1673 $ cd .. | |
1674 | |
1675 Testing the --abort flag for `hg graft` which aborts and rollback to state | |
1676 before the graft | |
1677 | |
1678 $ hg init abortgraft | |
1679 $ cd abortgraft | |
1680 $ for ch in a b c d; do echo $ch > $ch; hg add $ch; hg ci -Aqm "added "$ch; done; | |
1681 | |
1682 $ hg up '.^^' | |
1683 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
1684 | |
1685 $ echo x > x | |
1686 $ hg ci -Aqm "added x" | |
1687 $ hg up '.^' | |
1688 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1689 $ echo foo > c | |
1690 $ hg ci -Aqm "added foo to c" | |
1691 | |
1692 $ hg log -GT "{rev}:{node|short} {desc}" | |
1693 @ 5:36b793615f78 added foo to c | |
1694 | | |
1695 | o 4:863a25e1a9ea added x | |
1696 |/ | |
1697 | o 3:9150fe93bec6 added d | |
1698 | | | |
1699 | o 2:155349b645be added c | |
1700 |/ | |
1701 o 1:5f6d8a4bf34a added b | |
1702 | | |
1703 o 0:9092f1db7931 added a | |
1704 | |
1705 $ hg up 9150fe93bec6 | |
1706 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1707 | |
1708 $ hg graft --abort | |
1709 abort: no interrupted graft to abort | |
1710 [255] | |
1711 | |
1712 when stripping is required | |
1713 $ hg graft -r 4 -r 5 | |
1714 grafting 4:863a25e1a9ea "added x" | |
1715 grafting 5:36b793615f78 "added foo to c" (tip) | |
1716 merging c | |
1717 warning: conflicts while merging c! (edit, then use 'hg resolve --mark') | |
1718 abort: unresolved conflicts, can't continue | |
1719 (use 'hg resolve' and 'hg graft --continue') | |
1720 [255] | |
1721 | |
1722 $ hg graft --continue --abort | |
1723 abort: cannot use '--continue' and '--abort' together | |
1724 [255] | |
1725 | |
1726 $ hg graft --abort --stop | |
1727 abort: cannot use '--abort' and '--stop' together | |
1728 [255] | |
1729 | |
1730 $ hg graft --abort --currentuser | |
1731 abort: cannot specify any other flag with '--abort' | |
1732 [255] | |
1733 | |
1734 $ hg graft --abort --edit | |
1735 abort: cannot specify any other flag with '--abort' | |
1736 [255] | |
1737 | |
1738 $ hg graft --abort | |
1739 graft aborted | |
1740 working directory is now at 9150fe93bec6 | |
1741 $ hg log -GT "{rev}:{node|short} {desc}" | |
1742 o 5:36b793615f78 added foo to c | |
1743 | | |
1744 | o 4:863a25e1a9ea added x | |
1745 |/ | |
1746 | @ 3:9150fe93bec6 added d | |
1747 | | | |
1748 | o 2:155349b645be added c | |
1749 |/ | |
1750 o 1:5f6d8a4bf34a added b | |
1751 | | |
1752 o 0:9092f1db7931 added a | |
1753 | |
1754 when stripping is not required | |
1755 $ hg graft -r 5 | |
1756 grafting 5:36b793615f78 "added foo to c" (tip) | |
1757 merging c | |
1758 warning: conflicts while merging c! (edit, then use 'hg resolve --mark') | |
1759 abort: unresolved conflicts, can't continue | |
1760 (use 'hg resolve' and 'hg graft --continue') | |
1761 [255] | |
1762 | |
1763 $ hg graft --abort | |
1764 graft aborted | |
1765 working directory is now at 9150fe93bec6 | |
1766 $ hg log -GT "{rev}:{node|short} {desc}" | |
1767 o 5:36b793615f78 added foo to c | |
1768 | | |
1769 | o 4:863a25e1a9ea added x | |
1770 |/ | |
1771 | @ 3:9150fe93bec6 added d | |
1772 | | | |
1773 | o 2:155349b645be added c | |
1774 |/ | |
1775 o 1:5f6d8a4bf34a added b | |
1776 | | |
1777 o 0:9092f1db7931 added a | |
1778 | |
1779 when some of the changesets became public | |
1780 | |
1781 $ hg graft -r 4 -r 5 | |
1782 grafting 4:863a25e1a9ea "added x" | |
1783 grafting 5:36b793615f78 "added foo to c" (tip) | |
1784 merging c | |
1785 warning: conflicts while merging c! (edit, then use 'hg resolve --mark') | |
1786 abort: unresolved conflicts, can't continue | |
1787 (use 'hg resolve' and 'hg graft --continue') | |
1788 [255] | |
1789 | |
1790 $ hg log -GT "{rev}:{node|short} {desc}" | |
1791 @ 6:6ec71c037d94 added x | |
1792 | | |
1793 | o 5:36b793615f78 added foo to c | |
1794 | | | |
1795 | | o 4:863a25e1a9ea added x | |
1796 | |/ | |
1797 o | 3:9150fe93bec6 added d | |
1798 | | | |
1799 o | 2:155349b645be added c | |
1800 |/ | |
1801 o 1:5f6d8a4bf34a added b | |
1802 | | |
1803 o 0:9092f1db7931 added a | |
1804 | |
1805 $ hg phase -r 6 --public | |
1806 | |
1807 $ hg graft --abort | |
1808 cannot clean up public changesets 6ec71c037d94 | |
1809 graft aborted | |
1810 working directory is now at 6ec71c037d94 | |
1811 | |
1812 when we created new changesets on top of existing one | |
1813 | |
1814 $ hg up '.^^' | |
1815 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
1816 $ echo y > y | |
1817 $ hg ci -Aqm "added y" | |
1818 $ echo z > z | |
1819 $ hg ci -Aqm "added z" | |
1820 | |
1821 $ hg up 3 | |
1822 1 files updated, 0 files merged, 3 files removed, 0 files unresolved | |
1823 $ hg log -GT "{rev}:{node|short} {desc}" | |
1824 o 8:637f9e9bbfd4 added z | |
1825 | | |
1826 o 7:123221671fd4 added y | |
1827 | | |
1828 | o 6:6ec71c037d94 added x | |
1829 | | | |
1830 | | o 5:36b793615f78 added foo to c | |
1831 | | | | |
1832 | | | o 4:863a25e1a9ea added x | |
1833 | | |/ | |
1834 | @ | 3:9150fe93bec6 added d | |
1835 |/ / | |
1836 o / 2:155349b645be added c | |
1837 |/ | |
1838 o 1:5f6d8a4bf34a added b | |
1839 | | |
1840 o 0:9092f1db7931 added a | |
1841 | |
1842 $ hg graft -r 8 -r 7 -r 5 | |
1843 grafting 8:637f9e9bbfd4 "added z" (tip) | |
1844 grafting 7:123221671fd4 "added y" | |
1845 grafting 5:36b793615f78 "added foo to c" | |
1846 merging c | |
1847 warning: conflicts while merging c! (edit, then use 'hg resolve --mark') | |
1848 abort: unresolved conflicts, can't continue | |
1849 (use 'hg resolve' and 'hg graft --continue') | |
1850 [255] | |
1851 | |
1852 $ cd .. | |
1853 $ hg init pullrepo | |
1854 $ cd pullrepo | |
1855 $ cat >> .hg/hgrc <<EOF | |
1856 > [phases] | |
1857 > publish=False | |
1858 > EOF | |
1859 $ hg pull ../abortgraft --config phases.publish=False | |
1860 pulling from ../abortgraft | |
1861 requesting all changes | |
1862 adding changesets | |
1863 adding manifests | |
1864 adding file changes | |
1865 added 11 changesets with 9 changes to 8 files (+4 heads) | |
1866 new changesets 9092f1db7931:6b98ff0062dd | |
1867 (run 'hg heads' to see heads, 'hg merge' to merge) | |
1868 $ hg up 9 | |
1869 5 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1870 $ echo w > w | |
1871 $ hg ci -Aqm "added w" --config phases.publish=False | |
1872 | |
1873 $ cd ../abortgraft | |
1874 $ hg pull ../pullrepo | |
1875 pulling from ../pullrepo | |
1876 searching for changes | |
1877 adding changesets | |
1878 adding manifests | |
1879 adding file changes | |
1880 added 1 changesets with 1 changes to 1 files (+1 heads) | |
1881 new changesets 311dfc6cf3bf | |
1882 (run 'hg heads .' to see heads, 'hg merge' to merge) | |
1883 | |
1884 $ hg graft --abort | |
1885 new changesets detected on destination branch, can't strip | |
1886 graft aborted | |
1887 working directory is now at 6b98ff0062dd |