77

I have recently moved the SVN server and now i am tring to relocate the working copies from my computer to the new server. But i get the strangest error. i do :

svn switch http://99.99.99.new/svn/company/project/trunk/web

but i get

svn: 'http://99.99.99.old/svn/company/project/trunk/web'
is not the same repository as
'http://99.99.99.new/svn/company/project'

the move was made with dump and import ... and the repo root is on http://99.99.99.new/svn/company/project

Do you guys have any ideas of what might be wrong ? thanks a lot

Braiam
  • 1
  • 11
  • 47
  • 78
Gabriel Solomon
  • 29,065
  • 15
  • 57
  • 79

5 Answers5

131

Try using

svn switch --relocate http://99.99.99.old/svn/company/project/trunk/web http://99.99.99.new/svn/company/project/trunk/web

As noted by Sporino in the comments, since Subversion 1.7, there's a seperate relocate command:

svn relocate http://99.99.99.old/svn/company/project/trunk/web http://99.99.99.new/svn/company/project/trunk/web
Steef
  • 33,059
  • 4
  • 45
  • 36
  • 1
    @Steef so url should be identical to previous one exept, that it will be pointing to another location? So for example `svn switch --relocate .../project1/trunk/SomeDir .../project2/trunk` wount work, right? I need to have `svn switch --relocate .../project1/trunk/SomeDir .../project2/trunk/SomeDir`? – Eugene Oct 07 '12 at 10:51
  • 1
    Since subversion 1.7 there is a new command called relocate to do the same. – Robert Kühne Apr 04 '13 at 08:42
  • @Eugene Relocate to the new "base location" with `svn switch --relocate http://old.location/svn/project/trunk http://new.location/svn/project/trunk`. This should not be an existing repository. Afterwards use the normal switch command to your repository `svn switch http://new.location/svn/projects/project/trunk`. – Nicky Vandevoorde Nov 05 '13 at 10:30
23

Also, in TortoiseSVN there is "Relocate" option, which you should use in situations like these (instead of the "Switch" option).

Pascal Lindelauf
  • 4,782
  • 4
  • 40
  • 55
7

My best way to do an SVN relocation is this:

svn switch --relocate $(svn info | grep ^URL | cut -f 2 --delim=' ') \
                      new_url_or_repository

In this way, using the right old url from the svn info command, you are sure to not enter a wrong one, which is one of the common erros.

If everything is correct, you will be prompted with the auth details for the new location, if they are different.

After issuing the command, be sure to double check that the change has been applied looking at the URL parameter, issuing

svn info

After relocating, update your working copy, to check that everything is ok:

svn update

My 2c ..

GabrieleV
  • 2,303
  • 2
  • 16
  • 9
4

Use the relocate command line parameter to the switch command.

svn switch documentation

Sometimes an administrator might change the "base location" of your repository — in other words, the contents of the repository doesn't change, but the main URL used to reach the root of the repository does. For example, the hostname may change, or the URL schema, or perhaps just the path which leads to the repository. Rather than checkout a new working copy, you can have the svn switch command "rewrite" the the beginnings of all the URLs in your working copy. Use the --relocate command to do the substitution. No file contents are changed, nor is the repository contacted. It's similar to running a perl script over your working copy .svn/ directories which runs s/OldRoot/NewRoot/.

crashmstr
  • 28,043
  • 9
  • 61
  • 79
1

You need to use the --relocate option :

svn switch --relocate http://99.99.99.new/svn/company/project/trunk/web

see svnbook for more details.

Peter Parker
  • 29,093
  • 5
  • 52
  • 80
  • thanks for the suggestion, but as BastardSaint wrote you need to specify both from and to URLS – Gabriel Solomon May 29 '09 at 13:25
  • 1
    Just more of the poor UI design that irks me about subversion and SVK. There may be exotic use-cases that require you to specify two URLs, but the tools should just take the damn default. In SVK, for example, I shouldn't *NEED* to specify merge source and target, but I do. – Chris K May 29 '09 at 14:00