# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 2016-12-22 17:57:32 # Node ID 07fa9765b821f54778a465be2a4c0cb7f39e4443 # Parent 10b17ed9b591ec1908126f2675a6adbb5a33efb1 shelve: add tests to ensure illegal shelve names are avoided We avoid '.' as the first letter of shelve name so that we don't create hidden file. We also avoid slashes in name so that we don't form a new directory diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -100,6 +100,46 @@ make sure shelve files were backed up default.hg default.patch +checks to make sure we dont create a directory or +hidden file while choosing a new shelve name + +when we are given a name + + $ hg shelve -n foo/bar + abort: shelved change names may not contain slashes + [255] + $ hg shelve -n .baz + abort: shelved change names may not start with '.' + [255] + $ hg shelve -n foo\\bar + abort: shelved change names may not contain slashes + [255] + +when shelve has to choose itself + + $ hg branch x/y -q + $ hg commit -q -m "Branch commit 0" + $ hg shelve + nothing changed + [1] + $ hg branch .x -q + $ hg commit -q -m "Branch commit 1" + $ hg shelve + abort: shelved change names may not start with '.' + [255] + $ hg branch x\\y -q + $ hg commit -q -m "Branch commit 2" + $ hg shelve + abort: shelved change names may not contain slashes + [255] + +cleaning the branches made for name checking tests + + $ hg up default -q + $ hg strip 3 -q + $ hg strip 2 -q + $ hg strip 1 -q + create an mq patch - shelving should work fine with a patch applied $ echo n > n @@ -128,15 +168,6 @@ set up some more complex changes to shel c R b/b -prevent some foot-shooting - - $ hg shelve -n foo/bar - abort: shelved change names may not contain slashes - [255] - $ hg shelve -n .baz - abort: shelved change names may not start with '.' - [255] - the common case - no options or filenames $ hg shelve