* subversion/libsvn_client/shelf.c (svn_client_shelf_set_current_version): Don't try to open version 0. (svn_client_shelf_version_open): Throw an error on trying to open a non-existent version, as is already documented.
* subversion/svn/shelf-cmd.c (get_newest_version_existing): New. (shelf_restore, shelf_diff): Use it, thus throwing a suitable error on a non-existent version. (shelves_list): Write "no versions" explicitly when it is so. (shelf_list_by_paths): Don't try to read from shelves with no versions.