[Editor's note: this posting has been updated to correct an inaccuracy about which Subversion function should be used to associate working directories with new URLs.]
Pete Freitag mentions a way to move a Subversion repository from one server to another server by making a dumpfile from the old repository and importing it into the new repository. I've had to accomplish the same thing, but I was faced with an extra step afterward. If you're like me, you may have some changes that you're testing in your working directory but haven't yet committed; so how do you keep those changes while reassigning your local working directory to use the new repository?
The answer is the "switch" function. Just select the top level of your working directory and run "switch" The answer is the "relocate" function. Just select the top level of your working directory and run "relocate"(which in the case of my SVN client, TortoiseSVN, means right-clicking on the working directory.) You'll see a dialog that looks something like this:

Just enter the URL for the new server, and all of your local SVN files will be updated to use the new repository. That way, you don't have to check out from the new repository and you can keep changes that you haven't yet committed.

Comments (6)
February 13, 2008
16:18PM | #
Good point Tom (and thanks for the mention), in my case I was using the same url for the repository, and I made sure the new repostory had the same UUID as the old, this way all authentication tokens remained in tack.
February 14, 2008
09:58AM | #
small correction:
you shouls use the relocate command if the url of the server changes.
Switch should only be used if you want to switch from e.g., a branch to trunk (i.e., inside the same repository).
This is explained in the docs....
February 14, 2008
10:00AM | #
If the server URL changes, you must not use the switch command but the relocate command.
February 14, 2008
11:07AM | #
Stefan, thanks very much for correcting me. I've edited the posting so that it refers to the relocate command instead of switch.
April 22, 2008
05:16AM | #
I'm SO glad you wrote this, you just saved me an important hour of not checking out from the new sever, deleting all the .svn folders and re-committing to the new server.
Thanks!
August 20, 2008
22:54PM | #
Hey! That's not yet quite right either. At least according to my version of SVN:
svn help switch
switch (sw): Update the working copy to a different URL.
usage: 1. switch URL [PATH]
2. switch --relocate FROM TO [PATH...]
"svn switch --relocate"
NOT
"svn relocate"
and NOT
"svn switch"
Thank you thank you good night.