Thu 5 Apr 2007
In short: Before you switch between branches, delete all files that are ignored by subversion. If you don’t, you will receive errors like these:
svn: Won't delete locally modified directory '.' svn: Left locally modified or unversioned files
svn status looks weird after such a failed switch:
markus@markus:/var/www/community$ svn status ! . S app ! S admin ! admin/tmp ? admin/tmp/cache/models ! admin/tmp/cache S sql ...
What’s going on? Let’s assume that I checked out a branch and want to switch to the trunk. In the branch a directory admin/tmp/cache/models was added and its svn:ignore was set to *, that is, all files inside that directory are ignored. Now there appeared files inside this directory. I issue the switch to branch command and got the above error message. That means, that there were some files inside models that are ignored by subversion. The switch operation deleted the .svn directory in admin/tmp/cache/models but didn’t remove the directory itself because it won’t delete files that it doesn’t control – specificially the ignored files in admin/tmp/cache/models. How to get out of that situation?
At first, switch back to where you were, i.e. to the branch. This will give you the following error:
... svn: Failed to add directory 'admin/tmp/cache/models': object of the same name already exists
svn status looks much better now:
markus@markus:/var/www/community$ svn status ! . ! admin ! admin/tmp ? admin/tmp/cache/models ! admin/tmp/cache
Now delete the unversioned models directory and switch again to the branch:
... A admin/tmp/cache/models ...
Now delete all ignored files by hand. To find out which files exist that are ignored, use svn status --no-ignore. Note that ignored files interfere with the switch only if they are in a directory that exists only in the branch. Now the switch to the trunk should work without a glitch.