Mercurial > hg
changeset 42613:35ebdbb38efb
continue: added support for rebase
This adds support of rebase to hg continue plan.
An independent continue logic for rebase is created
under continuerebase() function. For this a seperate
rebaseruntime object is created under the function to
handle an interrupted rebasestate.
Results of tests are shown.
Differential Revision: https://phab.mercurial-scm.org/D6646
author | Taapas Agrawal <taapas2897@gmail.com> |
---|---|
date | Tue, 16 Jul 2019 01:59:28 +0530 |
parents | 3c16b9c0b099 |
children | 117437f3f541 |
files | hgext/rebase.py tests/test-narrow-rebase.t tests/test-rebase-abort.t tests/test-rebase-legacy.t tests/test-rebase-mq-skip.t tests/test-rebase-transaction.t |
diffstat | 6 files changed, 62 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/rebase.py Mon Jul 15 22:23:31 2019 +0530 +++ b/hgext/rebase.py Tue Jul 16 01:59:28 2019 +0530 @@ -1928,6 +1928,17 @@ rbsrt = rebaseruntime(repo, ui) rbsrt._prepareabortorcontinue(isabort=True) +def continuerebase(ui, repo): + with repo.wlock(), repo.lock(): + rbsrt = rebaseruntime(repo, ui) + ms = mergemod.mergestate.read(repo) + mergeutil.checkunresolved(ms) + retcode = rbsrt._prepareabortorcontinue(isabort=False) + if retcode is not None: + return retcode + rbsrt._performrebase(None) + rbsrt._finishrebase() + def summaryhook(ui, repo): if not repo.vfs.exists('rebasestate'): return @@ -1956,4 +1967,5 @@ _("specify merge tool for rebase"))) cmdutil.summaryhooks.add('rebase', summaryhook) statemod.addunfinished('rebase', fname='rebasestate', stopflag=True, - continueflag=True, abortfunc=abortrebase) + continueflag=True, abortfunc=abortrebase, + continuefunc=continuerebase)
--- a/tests/test-narrow-rebase.t Mon Jul 15 22:23:31 2019 +0530 +++ b/tests/test-narrow-rebase.t Tue Jul 16 01:59:28 2019 +0530 @@ -1,3 +1,10 @@ +#testcases continuecommand continueflag +#if continueflag + $ cat >> $HGRCPATH <<EOF + > [alias] + > continue = rebase --continue + > EOF +#endif $ . "$TESTDIR/narrow-library.sh" @@ -69,7 +76,7 @@ $ echo modified3 > inside/f1 $ hg resolve -m 2>&1 | grep -v continue: (no more unresolved files) - $ hg rebase --continue + $ hg continue rebasing 6:cdce97fbf653 "conflicting inside/f1" (tip) saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-rebase.hg (glob)
--- a/tests/test-rebase-abort.t Mon Jul 15 22:23:31 2019 +0530 +++ b/tests/test-rebase-abort.t Tue Jul 16 01:59:28 2019 +0530 @@ -1,4 +1,5 @@ #testcases abortcommand abortflag +#testcases continuecommand continueflag $ cat >> $HGRCPATH <<EOF > [extensions] @@ -18,6 +19,13 @@ > EOF #endif +#if continueflag + $ cat >> $HGRCPATH <<EOF + > [alias] + > continue = rebase --continue + > EOF +#endif + $ hg init a $ cd a @@ -162,7 +170,7 @@ $ hg --config extensions.mq= strip --quiet "destination()" $ mv .hg/rebasestate.back .hg/rebasestate - $ hg rebase --continue + $ hg continue abort: cannot continue inconsistent rebase (use "hg rebase --abort" to clear broken state) [255]
--- a/tests/test-rebase-legacy.t Mon Jul 15 22:23:31 2019 +0530 +++ b/tests/test-rebase-legacy.t Tue Jul 16 01:59:28 2019 +0530 @@ -1,3 +1,4 @@ +#testcases continuecommand continueflag Test rebase --continue with rebasestate written by legacy client $ cat >> $HGRCPATH <<EOF @@ -6,6 +7,13 @@ > drawdag=$TESTDIR/drawdag.py > EOF +#if continueflag + $ cat >> $HGRCPATH <<EOF + > [alias] + > continue = rebase --continue + > EOF +#endif + $ hg init $ hg debugdrawdag <<'EOF' > D H @@ -40,7 +48,12 @@ > 6582e6951a9c48c236f746f186378e36f59f4928:0000000000000000000000000000000000000000 > EOF - $ hg rebase --continue +#if continuecommand + $ hg continue --dry-run + rebase in progress, will be resumed +#endif + + $ hg continue rebasing 4:c1e6b162678d "B" (B) rebasing 8:6f7a236de685 "D" (D) rebasing 2:de008c61a447 "E" (E)
--- a/tests/test-rebase-mq-skip.t Mon Jul 15 22:23:31 2019 +0530 +++ b/tests/test-rebase-mq-skip.t Tue Jul 16 01:59:28 2019 +0530 @@ -1,3 +1,4 @@ +#testcases continuecommand continueflag This emulates the effects of an hg pull --rebase in which the remote repo already has one local mq patch @@ -13,6 +14,12 @@ > tglog = log -G --template "{rev}: {node|short} '{desc}' tags: {tags}\n" > EOF +#if continueflag + $ cat >> $HGRCPATH <<EOF + > [alias] + > continue = rebase --continue + > EOF +#endif $ hg init a $ cd a @@ -155,7 +162,7 @@ (no more unresolved files) continue: hg rebase --continue - $ hg rebase --continue + $ hg continue already rebased 1:b4bffa6e4776 "r1" (qbase r1) as 057f55ff8f44 already rebased 2:c0fd129beb01 "r2" (r2) as 1660ab13ce9a already rebased 3:6ff5b8feed8e "r3" (r3) as 1660ab13ce9a
--- a/tests/test-rebase-transaction.t Mon Jul 15 22:23:31 2019 +0530 +++ b/tests/test-rebase-transaction.t Tue Jul 16 01:59:28 2019 +0530 @@ -1,3 +1,4 @@ +#testcases continuecommand continueflag Rebasing using a single transaction $ cat >> $HGRCPATH <<EOF @@ -15,6 +16,13 @@ > tglog = log -G --template "{rev}: {desc}" > EOF +#if continueflag + $ cat >> $HGRCPATH <<EOF + > [alias] + > continue = rebase --continue + > EOF +#endif + Check that a simple rebase works $ hg init simple && cd simple @@ -123,7 +131,7 @@ $ hg resolve -m (no more unresolved files) continue: hg rebase --continue - $ hg rebase --continue + $ hg continue already rebased 1:112478962961 "B" (B) as 79bc8f4973ce rebasing 3:c26739dbe603 "C" (C) rebasing 5:d24bb333861c "D" (D tip) @@ -177,7 +185,7 @@ |/ o 0: A - $ hg rebase --continue + $ hg continue rebasing 1:112478962961 "B" (B) rebasing 3:26805aba1e60 "C" (C) rebasing 5:f585351a92f8 "D" (D tip)