D6646: continue: added support for rebase
taapas1128 (Taapas Agrawal)
phabricator at mercurial-scm.org
Wed Jul 17 13:00:58 EDT 2019
taapas1128 updated this revision to Diff 15938.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D6646?vs=15914&id=15938
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D6646/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D6646
AFFECTED 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
CHANGE DETAILS
diff --git a/tests/test-rebase-transaction.t b/tests/test-rebase-transaction.t
--- a/tests/test-rebase-transaction.t
+++ b/tests/test-rebase-transaction.t
@@ -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)
diff --git a/tests/test-rebase-mq-skip.t b/tests/test-rebase-mq-skip.t
--- a/tests/test-rebase-mq-skip.t
+++ b/tests/test-rebase-mq-skip.t
@@ -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
diff --git a/tests/test-rebase-legacy.t b/tests/test-rebase-legacy.t
--- a/tests/test-rebase-legacy.t
+++ b/tests/test-rebase-legacy.t
@@ -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)
diff --git a/tests/test-rebase-abort.t b/tests/test-rebase-abort.t
--- a/tests/test-rebase-abort.t
+++ b/tests/test-rebase-abort.t
@@ -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]
diff --git a/tests/test-narrow-rebase.t b/tests/test-narrow-rebase.t
--- a/tests/test-narrow-rebase.t
+++ b/tests/test-narrow-rebase.t
@@ -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)
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -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)
To: taapas1128, durin42, martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list