tags:

views:

1293

answers:

3

Not for the first time, I've accidentally done "svn switch" from somewhere below the root of my project. This switches that subdirectory only, but how do I undo this?

If I try switching the subdirectory back to the original branch I get:

"svn: Directory 'subdir\_svn' containing working copy admin area is missing"

Update: I've got changes in the subdir, so I don't want to do a delete.

In the short term I've fixed it by reapplying the changes, but I was after a way to get Subversion to re-switch back to where I came from... or is this a missing feature?

+2  A: 

Quick hack: Delete the directory, go one level up, and run svn update.

Alexander
I have changes in my switched sandbox, so can't delete the subdirectory...
fiddlesticks
You can make a patch, do rm/svn up, and reapply the patch.
Marcin Gil
I hate svn. So much. It takes me a day of switching, updating, massaging, deleting and then switching a few times more to get a clean switch.
Rhythmic Fistman
A: 
svn revert <dir>

Or, yes, delete it and grab another copy.

Dan
A: 

Without knowing exactly how you did the switch and how your directory and repository layout is, it's hard to say what went wrong in your case.

There is no way to really "revert" a switch. Generally, svn switch can be undone by a switch back to the original location, i.e. when the original location is at svn://url/to/orig/dir, then the following should work:

Switching a subdirectory to a different part of the repository

svn switch svn://path/to/switched/dir/ subdir

... and switching it back again

svn switch svn://url/to/orig/dir subdir

In your case it sounds as if you tried to switch a directory that is not part of your working copy.

Palmin
This is basically what I tried. The error I got is in the question...
fiddlesticks