89

I've got a SVN Repository that has moved to a new address/path. However, I've got a working copy with uncommitted source code still pointing to the old (now invalid) repository path. How do you change a working copy to point at a new repository?

quano
  • 18,812
  • 25
  • 97
  • 108

7 Answers7

81

svn switch --relocate is deprecated as of version 1.7 of subversion. Use the svn relocate command instead.

It takes either FROM-PREFIX TO-PREFIX [PATH...] or TO-URL as arguments.

See

svn help relocate

for more information.

Michael Krebs
  • 1,212
  • 10
  • 11
58

Use the svn switch command with the --relocate command line option.

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
  • 1
    Thanks. This is what I used: svn switch --relocate file:///Users/user/old_repository/project/trunk file:///Users/user/new_repository/project/trunk – quano Jan 30 '10 at 03:02
  • Does not fix the URLs in svn:externals. Any idea how to do that ? – Axel Bregnsbo May 10 '17 at 07:03
29

Using TortoiseSVN

  1. Right click on working copy and select 'SVN Switch...'
  2. On 'Switch to branch' form Select new SVN path

Using Command

  1. Open console
  2. Navigate to the working copy cd [working copy path]
  3. Write the command svn relocate [new url]
Rajesh Loganathan
  • 11,129
  • 4
  • 78
  • 90
Ahmed Abdallah
  • 417
  • 4
  • 7
  • This is applicable only if using TortoiseSVN, which the poster didn't indicate he or she is using. – zck Nov 04 '13 at 22:02
  • Hi @zck please note that I wrote 2 solution in 1 answer first TortoiseSVN and **the second is Command this command is deprecated for subversion in general** you can review this page [svn relocate/svn Subcommands](http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.relocate.html) – Ahmed Abdallah Nov 09 '13 at 01:01
  • Well, your answer was edited after I commented to include a commandline way of doing it. That commandline answer was already posted in June, so there's no need to repeat it. – zck Nov 09 '13 at 01:07
  • No, I post the answer in its current words my edit just for improve formatting; and I think the command I wrote is more clear than the one was wrote in June – Ahmed Abdallah Nov 09 '13 at 01:38
  • The TortoiseSVN GUI way requires a click on 'relocate', and not switch. Which makes sense given the command line.. Not sure what switch would do -- it seemed to be trying to access the old URL and the new URL, something I didn't want it to do. – Gerard ONeill Oct 02 '19 at 20:58
12

To be more precise

svn switch --relocate [complete url of the old repo] [complete url of the new repo] 

For example:

svn switch --relocate  http://svn.repo.com:9880/website/branches  http://svnrepo.com/web/branches 
BTR Naidu
  • 1,063
  • 3
  • 18
  • 45
4

Using TortoiseSVN tortoisesvn docs

  1. Go to the working copy's root folder
  2. Right Click, Click TortoiseSVN Submenu, Click Relocate.
  3. Enter the new path
Gerard ONeill
  • 3,914
  • 39
  • 25
Yitzhak Weinberg
  • 2,324
  • 1
  • 17
  • 21
1

Very Simple :

Step 1: Open command prompt / terminal and set workpath

Step 2: Execute this line svn switch --relocate http://newurl

Rajesh Loganathan
  • 11,129
  • 4
  • 78
  • 90
0

I had changed my svn server to force redirect everything from HTTP to HTTPS (and it could have been a redirect to any other URL), and I noticed that this svn relocate command was causing lots of problems with externals. Fortunately I found that the easiest thing was to just do an svn update and due to the redirect of the svn server, it updated all the URLs store in the local working copy, including the externals.

Gunther Schadow
  • 1,490
  • 13
  • 22