It seems to me that svn switch in its current form is broken. I think that it
1) Perform lookahead on all the directories it will touch to tell whether or not
it is going to fail due to unversioned files, and if so fail with an error
message before making ANY changes to the user's working copy
2) Ignore unversioned resources as others have suggested above.
It is important that SVN commands be atomic whenever possible, and having a
command be able to fail "halfway through" and leave junk behind is IMHO
unacceptable in all cases except for unpredictable errors (such as network
outages). In the case of errors that can be detected in advance, such as
unversioned files sitting in a directory, a command should either detect the
problem and fail before any changes have been made, or it should fail while
making changes but then roll back the working copy to its original state before
exiting. In either case, it should definitely not corrupt the user's working
copy due to a problem that could have been detected before any changes were made.
It is quite irritating, as an administrator of Subversion, to have to keep
directing users to read the FAQ and execute arcane sets of command-line
instructions (which, for many users, necessitates finding and installing
command-line tools, which they may not even have on their systems) for issues
such as this. This is a case where I think Subversion should "just work" rather
than failing and leaving things in a broken state as it does now, requiring
research and manual intervention of an expert user to fix.
Original comment by ixchel