Mercurial > hg
diff tests/test-shelve2.t @ 42599:3fb0493812c0
abort: added support for unshelve
This patch adds the support for shelve in `hg abort` plan.
For this the logic to load a `shelvedstate` and the error
handling for it had been shifted to a seperate function
`_loadunshelvedstate()`. This returns a tuple with `state` file
and `opts.`
`hgabortunshelve()` has been created for independent calls.
In case abortion of `unshelve` is called via `hg abort` the
`shelvedstate` needs to be loaded seperately. This has been
ensured by `_loadunshelvedstate()`
`hgabortunshelve()` is then registered as `abortfunc` for state
detection API.
Results are shown as tests.
Differential Revision: https://phab.mercurial-scm.org/D6579
author | Taapas Agrawal <taapas2897@gmail.com> |
---|---|
date | Wed, 26 Jun 2019 22:15:07 +0530 |
parents | 8ddfdcce4bd6 |
children | 3bc400ccbf99 |
line wrap: on
line diff
--- a/tests/test-shelve2.t Wed Jul 10 23:11:55 2019 +0530 +++ b/tests/test-shelve2.t Wed Jun 26 22:15:07 2019 +0530 @@ -1,4 +1,5 @@ #testcases stripbased phasebased +#testcases abortflag abortcommand $ cat <<EOF >> $HGRCPATH > [extensions] @@ -19,6 +20,13 @@ #endif +#if abortflag + $ cat >> $HGRCPATH <<EOF + > [alias] + > abort = unshelve --abort + > EOF +#endif + shelve should leave dirstate clean (issue4055) $ hg init shelverebase @@ -285,7 +293,14 @@ >>>>>>> working-copy: aef214a5229c - shelve: changes to: commit stuff $ cat f.orig g - $ hg unshelve --abort + +#if abortcommand +when in dry-run mode + $ hg abort --dry-run + unshelve in progress, will be aborted +#endif + + $ hg abort unshelve of 'default' aborted $ hg st ? f.orig @@ -695,7 +710,7 @@ [255] Unshelve --abort works with a corrupted shelvedstate - $ hg unshelve --abort + $ hg abort abort: could not read shelved state file, your working copy may be in an unexpected state please update to some commit @@ -703,8 +718,10 @@ Unshelve --abort fails with appropriate message if there's no unshelve in progress - $ hg unshelve --abort - abort: no unshelve in progress + $ hg abort + abort: no unshelve in progress (abortflag !) + abort: merge in progress but does not support 'hg abort' (no-abortflag !) + (use 'hg commit' or 'hg merge --abort') (no-abortflag !) [255] $ cd .. @@ -824,7 +841,7 @@ warning: conflicts while merging a! (edit, then use 'hg resolve --mark') unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') [1] - $ hg unshelve --abort + $ hg abort unshelve of 'default' aborted Unshelve without .shelve metadata (can happen when upgrading a repository with old shelve) @@ -843,7 +860,7 @@ [1] $ cat .hg/shelved/default.shelve node=82e0cb9893247d12667017593ce1e5655860f1ac - $ hg unshelve --abort + $ hg abort unshelve of 'default' aborted #endif