D6652: continue: added support for unshelve
taapas1128 (Taapas Agrawal)
phabricator at mercurial-scm.org
Wed Jul 17 17:01:17 UTC 2019
taapas1128 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
This patch adds the support for `ushelve` in `hg continue` plan.
`hgcontinueunshelve()` has been created for independent calls.
In case an interrupted unshelve is resumed via hg continue the
shelvedstate needs to be loaded seperately. This has been
ensured by `_loadunshelvedstate()`
`hgcontinueunshelve()` is then registered as `continuefunc` for state
detection API.
Results are shown as tests.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D6652
AFFECTED FILES
mercurial/commands.py
mercurial/shelve.py
tests/test-shelve2.t
CHANGE DETAILS
diff --git a/tests/test-shelve2.t b/tests/test-shelve2.t
--- a/tests/test-shelve2.t
+++ b/tests/test-shelve2.t
@@ -1,5 +1,6 @@
#testcases stripbased phasebased
#testcases abortflag abortcommand
+#testcases continueflag continuecommand
$ cat <<EOF >> $HGRCPATH
> [extensions]
@@ -27,6 +28,13 @@
> EOF
#endif
+#if continueflag
+ $ cat >> $HGRCPATH <<EOF
+ > [alias]
+ > continue = unshelve --continue
+ > EOF
+#endif
+
shelve should leave dirstate clean (issue4055)
$ hg init shelverebase
@@ -560,7 +568,7 @@
$ hg resolve --mark a
(no more unresolved files)
continue: hg unshelve --continue
- $ hg unshelve --continue
+ $ hg continue
marked working directory as branch test
unshelve of 'default' complete
$ cat a
@@ -641,7 +649,13 @@
$ hg resolve --mark a
(no more unresolved files)
continue: hg unshelve --continue
- $ hg unshelve --continue
+
+#if continuecommand
+ $ hg continue --dry-run
+ unshelve in progress, will be resumed
+#endif
+
+ $ hg continue
unshelve of 'default' complete
$ cat a
aaabbbccc
@@ -704,7 +718,7 @@
$ echo somethingsomething > .hg/shelvedstate
Unshelve --continue fails with appropriate message if shelvedstate is corrupted
- $ hg unshelve --continue
+ $ hg continue
abort: corrupted shelved state file
(please run hg unshelve --abort to abort unshelve operation)
[255]
@@ -751,7 +765,7 @@
$ hg resolve --mark file
(no more unresolved files)
continue: hg unshelve --continue
- $ hg unshelve --continue
+ $ hg continue
unshelve of 'default' complete
$ hg shelve --list
default (*s ago) * changes to: 1 (glob)
@@ -822,7 +836,7 @@
(no more unresolved files)
continue: hg unshelve --continue
mercurial does not crash
- $ hg unshelve --continue
+ $ hg continue
unshelve of 'ashelve' complete
#if phasebased
diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -751,6 +751,12 @@
unshelvecleanup(ui, repo, state.name, opts)
ui.status(_("unshelve of '%s' complete\n") % state.name)
+def hgcontinueunshelve(ui, repo):
+ """logic to resume unshelve using 'hg continue'"""
+ with repo.wlock():
+ state = _loadshelvedstate(ui, repo, {'continue' : True})
+ return unshelvecontinue(ui, repo, state, {'keep' : state.keep})
+
def _commitworkingcopychanges(ui, repo, opts, tmpwctx):
"""Temporarily commit working copy changes before moving unshelve commit"""
# Store pending changes in a commit and remember added in case a shelve
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6219,6 +6219,7 @@
statemod.addunfinished(
'unshelve', fname='shelvedstate', continueflag=True,
abortfunc=shelvemod.hgabortunshelve,
+ continuefunc=shelvemod.hgcontinueunshelve,
cmdmsg=_('unshelve already in progress'),
)
To: taapas1128, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list