77
votes

I am moving my Subversion repository from one machine to another. I have a few scattered working copies on various machines, and I have found that I can easily switch the working copies from the old server to the new one with the following command:

svn --relocate svn://oldServer/repo svn://newServer/repo

However, on one of my machines, I use Eclipse with Subclipse, and I don't like to use command-line SVN on my Eclipse projects. My question is whether it is possible to switch SVN repositories from within Eclipse using either Subclipse or Subversive.

9

9 Answers

99
votes

I think you need to go into your 'repository browser' perspective there you right click your current repository and 'relocate' it to another domain.

15
votes

Do not use the "Team/switch" option, but rather change to the "SVN repository exploring" perspective and change the URL location there in the location properties of your repository. Works like a charm on Indigo - using Subversive in my case.

When using Subversive this will show a warning "The attached projects will be relocated because the repository root URL differs from the previously entered one", which is just what you want. Be sure to open all projects you want relocated before doing this.

When getting "Cannot relocate the connected projects" with "Relocation cannot be performed because the new URL refers to the different repository" then maybe your repository root has no trunk/tags/branches folders, or has such folders in subfolders as well. Then on the tabsheet Advanced, disabling the option Enable Structure Detection might help.

If you get "Relocation cannot be performed because the new URL refers to the repository which is not valid (incorrect URL or credentials specified)" then also make sure the root path within the new repository URL matches the root of the old URL. (In other words: ensure that /new/path in the screenshot above has the same subfolders as the old URL.)

13
votes

Just right click on the project-> team -> disconnect.

Then another right click on the project -> team -> share -> to your new SVN.

That's it!

4
votes

Within Eclipse Navigator, if you right-click the project name a submenu will appear. On that sub-menu select Team which will provide some addtional menu options. Select the "Swich to another Branch/Tag/Revision ..." and a window will appear allowing you to specify the new branch or in your case a new repository location.

2
votes

You can do the following:

Go to project explorer view -> right click on your project -> team -> switch ... and now select the new URL.

Thats all!

1
votes

I could not relocate from my eclipse. I have different projects on different branches and tags (read-only it’s only for comparing different versions) of the same repository. When the ip of our svn server changed, I could relocate through TortoiseSVN but not from Subclipse.

Changing from http://oldserver/svn/PROJECTNAME to http://newserver/svn/PROJECTNAME I get :

org.apache.subversion.javahl.CientException: Invalid operation on the current working directory
svn: Cannot relocate 'E:\…\workspaces\PROJECTNAME\tags\modulename\2.4.007\base' as it is not the root of a working copy; try relocating 'E:\…\workspaces\PROJECTNAME\tags\modulename\2.4.007' instead

Ok but I don’t have the control over this. I ended with a workaround involving my hosts file.

1
votes

In Eclipse, go to Window -> Perspective -> Open Perspective -> Other -> SVN Repository Exploring. Click Ok

Then right click on the repository you want to change -> Location Properties.

Change the url click finish.

That's it!

0
votes

You may be able to just swap the server names in DNS; this might be easier than switching all the working copies.

0
votes

team -> disconnect

and

team -> share -> to your new SVN

This is better solution than switch.