Mercurial > hg-stable
changeset 42614:117437f3f541
continue: added support for unshelve
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.
Differential Revision: https://phab.mercurial-scm.org/D6652
author | Taapas Agrawal <taapas2897@gmail.com> |
---|---|
date | Wed, 17 Jul 2019 22:24:17 +0530 |
parents | 35ebdbb38efb |
children | 56132ebd14c6 |
files | mercurial/commands.py mercurial/shelve.py tests/test-shelve2.t |
diffstat | 3 files changed, 26 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Tue Jul 16 01:59:28 2019 +0530 +++ b/mercurial/commands.py Wed Jul 17 22:24:17 2019 +0530 @@ -6219,6 +6219,7 @@ statemod.addunfinished( 'unshelve', fname='shelvedstate', continueflag=True, abortfunc=shelvemod.hgabortunshelve, + continuefunc=shelvemod.hgcontinueunshelve, cmdmsg=_('unshelve already in progress'), )
--- a/mercurial/shelve.py Tue Jul 16 01:59:28 2019 +0530 +++ b/mercurial/shelve.py Wed Jul 17 22:24:17 2019 +0530 @@ -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
--- a/tests/test-shelve2.t Tue Jul 16 01:59:28 2019 +0530 +++ b/tests/test-shelve2.t Wed Jul 17 22:24:17 2019 +0530 @@ -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