comparison 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
comparison
equal deleted inserted replaced
42598:8ddfdcce4bd6 42599:3fb0493812c0
1 #testcases stripbased phasebased 1 #testcases stripbased phasebased
2 #testcases abortflag abortcommand
2 3
3 $ cat <<EOF >> $HGRCPATH 4 $ cat <<EOF >> $HGRCPATH
4 > [extensions] 5 > [extensions]
5 > mq = 6 > mq =
6 > [defaults] 7 > [defaults]
15 $ cat <<EOF >> $HGRCPATH 16 $ cat <<EOF >> $HGRCPATH
16 > [format] 17 > [format]
17 > internal-phase = yes 18 > internal-phase = yes
18 > EOF 19 > EOF
19 20
21 #endif
22
23 #if abortflag
24 $ cat >> $HGRCPATH <<EOF
25 > [alias]
26 > abort = unshelve --abort
27 > EOF
20 #endif 28 #endif
21 29
22 shelve should leave dirstate clean (issue4055) 30 shelve should leave dirstate clean (issue4055)
23 31
24 $ hg init shelverebase 32 $ hg init shelverebase
283 ======= 291 =======
284 f 292 f
285 >>>>>>> working-copy: aef214a5229c - shelve: changes to: commit stuff 293 >>>>>>> working-copy: aef214a5229c - shelve: changes to: commit stuff
286 $ cat f.orig 294 $ cat f.orig
287 g 295 g
288 $ hg unshelve --abort 296
297 #if abortcommand
298 when in dry-run mode
299 $ hg abort --dry-run
300 unshelve in progress, will be aborted
301 #endif
302
303 $ hg abort
289 unshelve of 'default' aborted 304 unshelve of 'default' aborted
290 $ hg st 305 $ hg st
291 ? f.orig 306 ? f.orig
292 $ cat f.orig 307 $ cat f.orig
293 g 308 g
693 abort: corrupted shelved state file 708 abort: corrupted shelved state file
694 (please run hg unshelve --abort to abort unshelve operation) 709 (please run hg unshelve --abort to abort unshelve operation)
695 [255] 710 [255]
696 711
697 Unshelve --abort works with a corrupted shelvedstate 712 Unshelve --abort works with a corrupted shelvedstate
698 $ hg unshelve --abort 713 $ hg abort
699 abort: could not read shelved state file, your working copy may be in an unexpected state 714 abort: could not read shelved state file, your working copy may be in an unexpected state
700 please update to some commit 715 please update to some commit
701 716
702 [255] 717 [255]
703 718
704 Unshelve --abort fails with appropriate message if there's no unshelve in 719 Unshelve --abort fails with appropriate message if there's no unshelve in
705 progress 720 progress
706 $ hg unshelve --abort 721 $ hg abort
707 abort: no unshelve in progress 722 abort: no unshelve in progress (abortflag !)
723 abort: merge in progress but does not support 'hg abort' (no-abortflag !)
724 (use 'hg commit' or 'hg merge --abort') (no-abortflag !)
708 [255] 725 [255]
709 $ cd .. 726 $ cd ..
710 727
711 Unshelve respects --keep even if user intervention is needed 728 Unshelve respects --keep even if user intervention is needed
712 $ hg init unshelvekeep && cd unshelvekeep 729 $ hg init unshelvekeep && cd unshelvekeep
822 rebasing shelved changes 839 rebasing shelved changes
823 merging a 840 merging a
824 warning: conflicts while merging a! (edit, then use 'hg resolve --mark') 841 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
825 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') 842 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
826 [1] 843 [1]
827 $ hg unshelve --abort 844 $ hg abort
828 unshelve of 'default' aborted 845 unshelve of 'default' aborted
829 846
830 Unshelve without .shelve metadata (can happen when upgrading a repository with old shelve) 847 Unshelve without .shelve metadata (can happen when upgrading a repository with old shelve)
831 848
832 $ cat .hg/shelved/default.shelve 849 $ cat .hg/shelved/default.shelve
841 warning: conflicts while merging a! (edit, then use 'hg resolve --mark') 858 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
842 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') 859 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
843 [1] 860 [1]
844 $ cat .hg/shelved/default.shelve 861 $ cat .hg/shelved/default.shelve
845 node=82e0cb9893247d12667017593ce1e5655860f1ac 862 node=82e0cb9893247d12667017593ce1e5655860f1ac
846 $ hg unshelve --abort 863 $ hg abort
847 unshelve of 'default' aborted 864 unshelve of 'default' aborted
848 865
849 #endif 866 #endif
850 867
851 $ cd .. 868 $ cd ..