comparison tests/test-rebase-obsolete.t @ 39093:cc37009e95ca

rebase: add --stop option to stop rebase at any point (issue5206) Before this patch, during a rebase if you get a point where you can't figure out what to do next, then either you had to complete your series or abandon all the work you have done during this rebase. Now, with this feature you can stop at any point by keeping the rebased csets and mark original csets as obsolete. And if you don't have evolution extension enabled then you can use --keep option as an alternative which will keep original csets too, instead of marking them obsolete. Differential Revision: https://phab.mercurial-scm.org/D3959
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Wed, 18 Jul 2018 00:25:52 +0530
parents ead71b15efd5
children 2cf0b8b830ba
comparison
equal deleted inserted replaced
39092:8943c1352b6c 39093:cc37009e95ca
13 > [phases] 13 > [phases]
14 > publish=False 14 > publish=False
15 > [extensions] 15 > [extensions]
16 > rebase= 16 > rebase=
17 > drawdag=$TESTDIR/drawdag.py 17 > drawdag=$TESTDIR/drawdag.py
18 > strip=
18 > EOF 19 > EOF
19 20
20 Setup rebase canonical repo 21 Setup rebase canonical repo
21 22
22 $ hg init base 23 $ hg init base
1786 | 1787 |
1787 o 2:b18e25de2cf5 D 1788 o 2:b18e25de2cf5 D
1788 | 1789 |
1789 o 0:426bada5c675 A 1790 o 0:426bada5c675 A
1790 1791
1792 ====================
1793 Test --stop option |
1794 ====================
1795 $ cd ..
1796 $ hg init rbstop
1797 $ cd rbstop
1798 $ echo a>a
1799 $ hg ci -Aqma
1800 $ echo b>b
1801 $ hg ci -Aqmb
1802 $ echo c>c
1803 $ hg ci -Aqmc
1804 $ echo d>d
1805 $ hg ci -Aqmd
1806 $ hg up 0 -q
1807 $ echo f>f
1808 $ hg ci -Aqmf
1809 $ echo D>d
1810 $ hg ci -Aqm "conflict with d"
1811 $ hg up 3 -q
1812 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1813 o 5:00bfc9898aeb test
1814 | conflict with d
1815 |
1816 o 4:dafd40200f93 test
1817 | f
1818 |
1819 | @ 3:055a42cdd887 test
1820 | | d
1821 | |
1822 | o 2:177f92b77385 test
1823 | | c
1824 | |
1825 | o 1:d2ae7f538514 test
1826 |/ b
1827 |
1828 o 0:cb9a9f314b8b test
1829 a
1830
1831 $ hg rebase -s 1 -d 5
1832 rebasing 1:d2ae7f538514 "b"
1833 rebasing 2:177f92b77385 "c"
1834 rebasing 3:055a42cdd887 "d"
1835 merging d
1836 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1837 unresolved conflicts (see hg resolve, then hg rebase --continue)
1838 [1]
1839 $ hg rebase --stop
1840 1 new orphan changesets
1841 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1842 o 7:7fffad344617 test
1843 | c
1844 |
1845 o 6:b15528633407 test
1846 | b
1847 |
1848 o 5:00bfc9898aeb test
1849 | conflict with d
1850 |
1851 o 4:dafd40200f93 test
1852 | f
1853 |
1854 | @ 3:055a42cdd887 test
1855 | | d
1856 | |
1857 | x 2:177f92b77385 test
1858 | | c
1859 | |
1860 | x 1:d2ae7f538514 test
1861 |/ b
1862 |
1863 o 0:cb9a9f314b8b test
1864 a
1865
1866 Test it aborts if unstable csets is not allowed:
1867 ===============================================
1868 $ cat >> $HGRCPATH << EOF
1869 > [experimental]
1870 > evolution.allowunstable=False
1871 > EOF
1872
1873 $ hg strip 6 --no-backup -q
1874 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1875 o 5:00bfc9898aeb test
1876 | conflict with d
1877 |
1878 o 4:dafd40200f93 test
1879 | f
1880 |
1881 | @ 3:055a42cdd887 test
1882 | | d
1883 | |
1884 | o 2:177f92b77385 test
1885 | | c
1886 | |
1887 | o 1:d2ae7f538514 test
1888 |/ b
1889 |
1890 o 0:cb9a9f314b8b test
1891 a
1892
1893 $ hg rebase -s 1 -d 5
1894 rebasing 1:d2ae7f538514 "b"
1895 rebasing 2:177f92b77385 "c"
1896 rebasing 3:055a42cdd887 "d"
1897 merging d
1898 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1899 unresolved conflicts (see hg resolve, then hg rebase --continue)
1900 [1]
1901 $ hg rebase --stop
1902 abort: cannot remove original changesets with unrebased descendants
1903 (either enable obsmarkers to allow unstable revisions or use --keep to keep original changesets)
1904 [255]
1905 $ hg rebase --abort
1906 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1907 rebase aborted
1908
1909 Test --stop when --keep is passed:
1910 ==================================
1911 $ hg rebase -s 1 -d 5 --keep
1912 rebasing 1:d2ae7f538514 "b"
1913 rebasing 2:177f92b77385 "c"
1914 rebasing 3:055a42cdd887 "d"
1915 merging d
1916 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1917 unresolved conflicts (see hg resolve, then hg rebase --continue)
1918 [1]
1919 $ hg rebase --stop
1920 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1921 o 7:7fffad344617 test
1922 | c
1923 |
1924 o 6:b15528633407 test
1925 | b
1926 |
1927 o 5:00bfc9898aeb test
1928 | conflict with d
1929 |
1930 o 4:dafd40200f93 test
1931 | f
1932 |
1933 | @ 3:055a42cdd887 test
1934 | | d
1935 | |
1936 | o 2:177f92b77385 test
1937 | | c
1938 | |
1939 | o 1:d2ae7f538514 test
1940 |/ b
1941 |
1942 o 0:cb9a9f314b8b test
1943 a
1944
1945 Test --stop aborts when --collapse was passed:
1946 =============================================
1947 $ cat >> $HGRCPATH << EOF
1948 > [experimental]
1949 > evolution.allowunstable=True
1950 > EOF
1951
1952 $ hg strip 6
1953 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1954 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1955 o 5:00bfc9898aeb test
1956 | conflict with d
1957 |
1958 o 4:dafd40200f93 test
1959 | f
1960 |
1961 | @ 3:055a42cdd887 test
1962 | | d
1963 | |
1964 | o 2:177f92b77385 test
1965 | | c
1966 | |
1967 | o 1:d2ae7f538514 test
1968 |/ b
1969 |
1970 o 0:cb9a9f314b8b test
1971 a
1972
1973 $ hg rebase -s 1 -d 5 --collapse -m "collapsed b c d"
1974 rebasing 1:d2ae7f538514 "b"
1975 rebasing 2:177f92b77385 "c"
1976 rebasing 3:055a42cdd887 "d"
1977 merging d
1978 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1979 unresolved conflicts (see hg resolve, then hg rebase --continue)
1980 [1]
1981 $ hg rebase --stop
1982 abort: cannot stop in --collapse session
1983 [255]
1984 $ hg rebase --abort
1985 rebase aborted
1986 $ hg diff
1987 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1988 o 5:00bfc9898aeb test
1989 | conflict with d
1990 |
1991 o 4:dafd40200f93 test
1992 | f
1993 |
1994 | @ 3:055a42cdd887 test
1995 | | d
1996 | |
1997 | o 2:177f92b77385 test
1998 | | c
1999 | |
2000 | o 1:d2ae7f538514 test
2001 |/ b
2002 |
2003 o 0:cb9a9f314b8b test
2004 a
2005