Show More
@@ -673,6 +673,7 b' class rebaseruntime(object):' | |||||
673 | ('D', 'detach', False, _('(DEPRECATED)')), |
|
673 | ('D', 'detach', False, _('(DEPRECATED)')), | |
674 | ('i', 'interactive', False, _('(DEPRECATED)')), |
|
674 | ('i', 'interactive', False, _('(DEPRECATED)')), | |
675 | ('t', 'tool', '', _('specify merge tool')), |
|
675 | ('t', 'tool', '', _('specify merge tool')), | |
|
676 | ('', 'stop', False, _('stop interrupted rebase')), | |||
676 | ('c', 'continue', False, _('continue an interrupted rebase')), |
|
677 | ('c', 'continue', False, _('continue an interrupted rebase')), | |
677 | ('a', 'abort', False, _('abort an interrupted rebase')), |
|
678 | ('a', 'abort', False, _('abort an interrupted rebase')), | |
678 | ('', 'auto-orphans', '', _('automatically rebase orphan revisions ' |
|
679 | ('', 'auto-orphans', '', _('automatically rebase orphan revisions ' | |
@@ -803,6 +804,7 b' def rebase(ui, repo, **opts):' | |||||
803 | opts = pycompat.byteskwargs(opts) |
|
804 | opts = pycompat.byteskwargs(opts) | |
804 | inmemory = ui.configbool('rebase', 'experimental.inmemory') |
|
805 | inmemory = ui.configbool('rebase', 'experimental.inmemory') | |
805 | dryrun = opts.get('dry_run') |
|
806 | dryrun = opts.get('dry_run') | |
|
807 | stop = opts.get('stop') | |||
806 | if dryrun: |
|
808 | if dryrun: | |
807 | if opts.get('abort'): |
|
809 | if opts.get('abort'): | |
808 | raise error.Abort(_('cannot specify both --dry-run and --abort')) |
|
810 | raise error.Abort(_('cannot specify both --dry-run and --abort')) | |
@@ -835,6 +837,27 b' def rebase(ui, repo, **opts):' | |||||
835 |
|
837 | |||
836 | if dryrun: |
|
838 | if dryrun: | |
837 | return _dryrunrebase(ui, repo, opts) |
|
839 | return _dryrunrebase(ui, repo, opts) | |
|
840 | elif stop: | |||
|
841 | rbsrt = rebaseruntime(repo, ui) | |||
|
842 | rbsrt.restorestatus() | |||
|
843 | ||||
|
844 | #todo: raise error for conflicting options | |||
|
845 | if rbsrt.collapsef: | |||
|
846 | raise error.Abort(_("cannot stop in --collapse session")) | |||
|
847 | allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) | |||
|
848 | if not (rbsrt.keepf or allowunstable): | |||
|
849 | raise error.Abort(_("cannot remove original changesets with" | |||
|
850 | " unrebased descendants"), | |||
|
851 | hint=_('either enable obsmarkers to allow unstable ' | |||
|
852 | 'revisions or use --keep to keep original ' | |||
|
853 | 'changesets')) | |||
|
854 | with repo.wlock(), repo.lock(): | |||
|
855 | if needupdate(repo, rbsrt.state): | |||
|
856 | # update to the current working revision | |||
|
857 | # to clear interrupted merge | |||
|
858 | hg.updaterepo(repo, rbsrt.originalwd, overwrite=True) | |||
|
859 | rbsrt._finishrebase() | |||
|
860 | return 0 | |||
838 | elif inmemory: |
|
861 | elif inmemory: | |
839 | try: |
|
862 | try: | |
840 | # in-memory merge doesn't support conflicts, so if we hit any, abort |
|
863 | # in-memory merge doesn't support conflicts, so if we hit any, abort |
@@ -15,6 +15,7 b' Enable obsolete' | |||||
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 | |
@@ -1788,3 +1789,217 b' Also test --continue for the above case' | |||||
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 |
General Comments 0
You need to be logged in to leave comments.
Login now