Skip to content
Snippets Groups Projects
Commit 832a6a2efe4f authored by Martin von Zweigbergk's avatar Martin von Zweigbergk
Browse files

tests: add tests for corrupt .hg/shelved/ directory

I don't care much how we behave in these cases, except that we should
provide a way for the user to get out of the broken state.

Differential Revision: https://phab.mercurial-scm.org/D9718
parent b9b37418ac7e
No related branches found
No related tags found
No related merge requests found
...@@ -745,6 +745,58 @@ ...@@ -745,6 +745,58 @@
#endif #endif
$ cd .. $ cd ..
Test corrupt shelves (in .hg/shelved/, not .hg/shelvestate)
$ hg init corrupt-shelves
$ cd corrupt-shelves
$ mkdir .hg/shelved
# A (corrupt) .patch file without a .hg file
$ touch .hg/shelved/junk1.patch
$ hg shelve -l
junk1 (* ago) (glob)
$ hg unshelve
unshelving change 'junk1'
abort: shelved change 'junk1' not found
[255]
$ hg shelve -d junk1
$ find .hg/shelve* | sort
.hg/shelve-backup
.hg/shelve-backup/junk1.patch
.hg/shelved
# A .hg file without a .patch file
$ touch .hg/shelved/junk2.hg
$ hg shelve -l
$ hg unshelve
abort: no shelved changes to apply!
[255]
$ hg shelve -d junk2
abort: shelved change 'junk2' not found
[255]
$ find .hg/shelve* | sort
.hg/shelve-backup
.hg/shelve-backup/junk1.patch
.hg/shelve-backup/junk2.hg
.hg/shelved
# A file with an unexpected extension
$ touch .hg/shelved/junk3
$ hg shelve -l 2>&1 | grep ValueError
ValueError: * (glob)
$ hg unshelve 2>&1 | grep ValueError
ValueError: * (glob)
$ hg shelve -d junk3
abort: shelved change 'junk3' not found
[255]
$ find .hg/shelve* | sort
.hg/shelve-backup
.hg/shelve-backup/junk1.patch
.hg/shelve-backup/junk2.hg
.hg/shelved
.hg/shelved/junk3
$ cd ..
Unshelve respects --keep even if user intervention is needed Unshelve respects --keep even if user intervention is needed
$ hg init unshelvekeep && cd unshelvekeep $ hg init unshelvekeep && cd unshelvekeep
$ echo 1 > file && hg ci -Am 1 $ echo 1 > file && hg ci -Am 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment